diff options
Diffstat (limited to 'lib/mount_util.c')
-rw-r--r-- | lib/mount_util.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/mount_util.c b/lib/mount_util.c index dccecdf..55b5f4e 100644 --- a/lib/mount_util.c +++ b/lib/mount_util.c @@ -14,15 +14,29 @@ #include <dirent.h> #include <errno.h> #include <limits.h> +#include <mntent.h> #include <sys/stat.h> #include <sys/wait.h> +static int mtab_is_symlink(void) +{ + struct stat stbuf; + + if (lstat(_PATH_MOUNTED, &stbuf) != -1 && S_ISLNK(stbuf.st_mode)) + return 1; + else + return 0; +} + int fuse_mnt_add_mount(const char *progname, const char *fsname, const char *mnt, const char *type, const char *opts) { int res; int status; + if (mtab_is_symlink()) + return 0; + res = fork(); if (res == -1) { fprintf(stderr, "%s: fork: %s\n", progname, strerror(errno)); @@ -72,6 +86,9 @@ int fuse_mnt_umount(const char *progname, const char *mnt, int lazy) int res; int status; + if (mtab_is_symlink()) + return 0; + res = fork(); if (res == -1) { fprintf(stderr, "%s: fork: %s\n", progname, strerror(errno)); |