Skip to content

Commit

Permalink
fuse_fs: fix deleting directories
Browse files Browse the repository at this point in the history
Issue #199.
  • Loading branch information
cnuke authored and nfeske committed Dec 17, 2021
1 parent 1c41dcf commit 560c535
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/server/fuse_fs/fuse_fs_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,21 @@ class Fuse_fs::Session_component : public Session_rpc_object
throw Invalid_name();
}

/* XXX remove direct use of FUSE operations */
struct stat s;
int res = -1;
/* XXX remove direct use of FUSE operations */
Libc::with_libc([&] () {
res = Fuse::fuse()->op.getattr(absolute_path.base(), &s);
});
if (res != 0)
throw Lookup_failed();

/* XXX remove direct use of FUSE operations */
Libc::with_libc([&] () {
res = Fuse::fuse()->op.unlink(absolute_path.base());
if (S_ISDIR(s.st_mode))
res = Fuse::fuse()->op.rmdir(absolute_path.base());
else
res = Fuse::fuse()->op.unlink(absolute_path.base());
});

if (res != 0) {
Expand Down

0 comments on commit 560c535

Please sign in to comment.