aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Nikolaus Rath <Nikolaus@rath.org>2016-10-04 10:55:12 -0700
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2016-10-04 10:55:12 -0700
commitc889148d35bf308954ba93d56cd416388f0e37a1 (patch)
treec41eb01f70daf8403c96dc2397686e25f283fcd6
parent5698ee09cf7a8495da70659ffae1eaec9f57db27 (diff)
fuse_session_unmount(): fix unmounting as root
We have to store the channel before removing it from the session, otherwise we cannot use it to do the unmount. This problem was introduced in commit 5698ee09cf7. Thanks to Michael Theall for reporting & debugging this.
-rwxr-xr-xlib/fuse_lowlevel.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index 43539da..2a7c580 100755
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -2988,11 +2988,12 @@ error_out:
void fuse_session_unmount(struct fuse_session *se)
{
- fuse_session_remove_chan(se->ch);
+ struct fuse_chan *ch = se->ch;
+ fuse_session_remove_chan(ch);
if (se->mountpoint) {
- int fd = se->ch ? fuse_chan_clearfd(se->ch) : -1;
+ int fd = ch ? fuse_chan_clearfd(ch) : -1;
fuse_kern_unmount(se->mountpoint, fd);
- fuse_chan_put(se->ch);
+ fuse_chan_put(ch);
free(se->mountpoint);
se->mountpoint = NULL;
}