aboutsummaryrefslogtreecommitdiffstats
path: root/util/fusermount.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/fusermount.c')
-rw-r--r--util/fusermount.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/util/fusermount.c b/util/fusermount.c
index e40c457..f37c616 100644
--- a/util/fusermount.c
+++ b/util/fusermount.c
@@ -523,11 +523,13 @@ static int unmount_fuse_locked(const char *mnt, int quiet, int lazy)
drop_privs();
res = chdir_to_parent(copy, &last);
- restore_privs();
- if (res == -1)
+ if (res == -1) {
+ restore_privs();
goto out;
+ }
res = umount2(last, umount_flags);
+ restore_privs();
if (res == -1 && !quiet) {
fprintf(stderr, "%s: failed to unmount %s: %s\n",
progname, mnt, strerror(errno));