From: Nikolaus Rath Date: Tue, 4 Oct 2016 17:55:12 +0000 (-0700) Subject: fuse_session_unmount(): fix unmounting as root X-Git-Tag: fuse-3.0.0rc1~92^2 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=c889148d35bf308954ba93d56cd416388f0e37a1;p=qemu-gpiodev%2Flibfuse.git 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. --- 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; }