diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2013-06-20 11:43:02 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2013-06-20 11:43:02 +0200 |
commit | af57c73304b8a23c6ca0e1aebf4ce49071ac784a (patch) | |
tree | 9ff233b9701a15ee9050d7b7237e9c4bc8164d0f /lib/helper.c | |
parent | 787fc5195b95c393e2bf6fb440a488c972c94fe4 (diff) |
libfuse: fix multiple close of device fd
- fuse_kern_unmount closes handle (e.g. 19)
- a thread in my process opens a file - the OS assigns newly freed
handle (i.e. 19)
- fuse_kern_chan_destroy closes the same handle (i.e. 19)
- a thread in my process opens another file - the OS assigns newly
freed handle (i.e. 19)
- * MAYHEM *
Reported by Dan Greenfield
Diffstat (limited to 'lib/helper.c')
-rw-r--r-- | lib/helper.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/helper.c b/lib/helper.c index 8ee66df..58dfb43 100644 --- a/lib/helper.c +++ b/lib/helper.c @@ -244,10 +244,12 @@ struct fuse_chan *fuse_mount(const char *mountpoint, struct fuse_args *args) void fuse_unmount(const char *mountpoint, struct fuse_chan *ch) { - int fd = ch ? fuse_chan_fd(ch) : -1; - fuse_kern_unmount(mountpoint, fd); - if (ch) - fuse_chan_destroy(ch); + if (mountpoint) { + int fd = ch ? fuse_chan_clearfd(ch) : -1; + fuse_kern_unmount(mountpoint, fd); + if (ch) + fuse_chan_destroy(ch); + } } static struct fuse *fuse_setup(int argc, char *argv[], |