Skip to content

Commit

Permalink
Fix bug with FUSE wrapper for readdir(2)
Browse files Browse the repository at this point in the history
Fixes: #45 #43
  • Loading branch information
ligurio committed Feb 27, 2021
1 parent acb708f commit 0e7d31e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 0 additions & 2 deletions tests/test_unreliablefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def test_symlink(setup_unreliablefs):
assert fstat.st_nlink == 1
assert linkname in os.listdir(mnt_dir)

@pytest.mark.xfail(sys.platform == "freebsd12", reason="gh-45")
def test_create(setup_unreliablefs):
mnt_dir, src_dir = setup_unreliablefs
name = name_generator()
Expand Down Expand Up @@ -344,7 +343,6 @@ def test_truncate_fd(setup_unreliablefs):
fh.seek(0)
assert fh.read(size) == TEST_DATA[:size-1024]

@pytest.mark.xfail(sys.platform == "freebsd12", reason="gh-43")
def test_passthrough(setup_unreliablefs):
mnt_dir, src_dir = setup_unreliablefs
name = name_generator()
Expand Down
7 changes: 4 additions & 3 deletions unreliablefs_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ int unreliable_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
return ret;
}

DIR *dp = (DIR *) fi->fh;
DIR *dp = opendir(path);
if (dp == NULL) {
return -errno;
}
Expand All @@ -475,8 +475,9 @@ int unreliable_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
if (filler(buf, de->d_name, &st, 0))
break;
}

return 0;
closedir(dp);

return 0;
}

int unreliable_releasedir(const char *path, struct fuse_file_info *fi)
Expand Down

0 comments on commit 0e7d31e

Please sign in to comment.