diff options
Diffstat (limited to 'contrib/fuse-lib/mount-common.c')
| -rw-r--r-- | contrib/fuse-lib/mount-common.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/contrib/fuse-lib/mount-common.c b/contrib/fuse-lib/mount-common.c index c436cb16a5c..cffd4c01ed5 100644 --- a/contrib/fuse-lib/mount-common.c +++ b/contrib/fuse-lib/mount-common.c @@ -32,7 +32,7 @@ mtab_needs_update (const char *mnt) struct stat stbuf; /* If mtab is within new mount, don't touch it */ - if (strncmp (mnt, _PATH_MOUNTED, strlen (mnt)) == 0 && + if (strncmp (mnt, _PATH_MOUNTED, sizeof (_PATH_MOUNTED) - 1) == 0 && _PATH_MOUNTED[strlen (mnt)] == '/') return 0; @@ -105,7 +105,11 @@ fuse_mnt_add_mount (const char *progname, const char *fsname, char *tmp; sigprocmask (SIG_SETMASK, &oldmask, NULL); - setuid (geteuid ()); + res = setuid (geteuid ()); + if (res != 0) { + GFFUSE_LOGERR ("%s: setuid: %s", progname, strerror (errno)); + exit (1); + } /* * hide in a directory, where mount isn't able to resolve @@ -245,18 +249,22 @@ fuse_mnt_umount (const char *progname, const char *abs_mnt, } if (res == 0) { sigprocmask (SIG_SETMASK, &oldmask, NULL); - setuid (geteuid ()); + res = setuid (geteuid ()); + if (res != 0) { + GFFUSE_LOGERR ("%s: setuid: %s", progname, strerror (errno)); + exit (1); + } #ifdef GF_LINUX_HOST_OS - execl ("/bin/umount", "/bin/umount", "-i", rel_mnt, + execl ("umount", "umount", "-i", rel_mnt, lazy ? "-l" : NULL, NULL); - GFFUSE_LOGERR ("%s: failed to execute /bin/umount: %s", + GFFUSE_LOGERR ("%s: failed to execute umount: %s", progname, strerror (errno)); #elif __NetBSD__ /* exitting the filesystem causes the umount */ exit (0); #else - execl ("/sbin/umount", "/sbin/umount", "-f", rel_mnt, NULL); - GFFUSE_LOGERR ("%s: failed to execute /sbin/umount: %s", + execl ("umount", "umount", "-f", rel_mnt, NULL); + GFFUSE_LOGERR ("%s: failed to execute umount: %s", progname, strerror (errno)); #endif /* GF_LINUX_HOST_OS */ exit (1); |
