aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Huffman <40582525+samh-sifive@users.noreply.github.com>2019-03-08 13:26:31 -0800
committerNikolaus Rath <Nikolaus@rath.org>2019-03-08 21:26:31 +0000
commit774eb66fc1eb006b601f3890958f02e7b90575ad (patch)
treec9c116b5bd24900b14dd8f418e9a6ac654a58998
parent1b7d2b886265daa5527f487c1b6e86d006574ac4 (diff)
downloadlibfuse-774eb66fc1eb006b601f3890958f02e7b90575ad.tar.gz
fusermount: drop privileges for chdir()
cd to mountpoint's parent directory using unprivileged rather than privileged access. This is to ensure that unmount works on mountpoints where root may not have privileged access. Fixes: #376
-rw-r--r--util/fusermount.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/util/fusermount.c b/util/fusermount.c
index e6ac792..3f13e42 100644
--- a/util/fusermount.c
+++ b/util/fusermount.c
@@ -428,7 +428,9 @@ static int unmount_fuse_locked(const char *mnt, int quiet, int lazy)
return -1;
}
+ drop_privs();
res = chdir_to_parent(copy, &last);
+ restore_privs();
if (res == -1)
goto out;