From 3d65fcca1ed2d29a00e4b28afbda36268b766117 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 8 Mar 2008 20:42:59 +0000 Subject: [PATCH] fix: unprivileged mount failed if user had rights for everything except the fuse device --- libfuse-lite/fusermount.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libfuse-lite/fusermount.c b/libfuse-lite/fusermount.c index 43db8e16..c321ce29 100644 --- a/libfuse-lite/fusermount.c +++ b/libfuse-lite/fusermount.c @@ -588,7 +588,13 @@ static int check_perm(const char **mntp, struct stat *stbuf, int *currdir_fd, static int try_open(const char *dev, char **devp) { - int fd = open(dev, O_RDWR); + int fd; + + if (restore_privs()) + return -1; + fd = open(dev, O_RDWR); + if (drop_privs()) + return -1; if (fd != -1) { *devp = strdup(dev); if (*devp == NULL) {