From c889148d35bf308954ba93d56cd416388f0e37a1 Mon Sep 17 00:00:00 2001 From: Nikolaus Rath <Nikolaus@rath.org> Date: Tue, 4 Oct 2016 10:55:12 -0700 Subject: [PATCH] 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. --- lib/fuse_lowlevel.c | 7 ++++--- 1 file 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; } -- 2.30.2