Simply #ifdefs
authorNikolaus Rath <Nikolaus@rath.org>
Thu, 3 Aug 2017 15:13:23 +0000 (17:13 +0200)
committerNikolaus Rath <Nikolaus@rath.org>
Thu, 3 Aug 2017 15:21:06 +0000 (17:21 +0200)
mount_bsd.c is only used when compiling for *BSD, and FreeBSD
is the only BSD that supports FUSE. So there really is no need
to check if this file is compiled under FreeBSD.

lib/mount_bsd.c

index 7f78fdd40511e56abff5f08cd7e064520c18fd51..31b41deaf7f7d36c41722f135f96068e02b1dc05 100644 (file)
 #include "fuse_misc.h"
 #include "fuse_opt.h"
 
-#ifdef __FreeBSD__
 #include <sys/param.h>
 #include <sys/mount.h>
-#endif
 
 #include <sys/stat.h>
 #include <sys/wait.h>
@@ -125,62 +123,11 @@ static int fuse_mount_opt_proc(void *data, const char *arg, int key,
        return 1;
 }
 
-#ifndef __FreeBSD__
-static void do_unmount(char *dev, int fd)
-{
-       char device_path[SPECNAMELEN + 12];
-       const char *argv[4];
-       const char umount_cmd[] = "/sbin/umount";
-       pid_t pid;
-
-       snprintf(device_path, SPECNAMELEN + 12, _PATH_DEV "%s", dev);
-
-       argv[0] = umount_cmd;
-       argv[1] = "-f";
-       argv[2] = device_path;
-       argv[3] = NULL;
-
-       pid = fork();
-
-       if (pid == -1)
-               return;
-
-       if (pid == 0) {
-               close(fd);
-               execvp(umount_cmd, (char **)argv);
-               exit(1);
-       }
-
-       waitpid(pid, NULL, 0);
-}
-#endif
-
 void fuse_kern_unmount(const char *mountpoint, int fd)
 {
        char *ep, dev[128];
        struct stat sbuf;
-
-#ifdef __FreeBSD__
        unmount(mountpoint, MNT_FORCE);
-#else
-       (void)mountpoint;
-
-       if (fstat(fd, &sbuf) == -1)
-               goto out;
-
-       devname_r(sbuf.st_rdev, S_IFCHR, dev, 128);
-
-       if (strncmp(dev, "fuse", 4))
-               goto out;
-
-       strtol(dev + 4, &ep, 10);
-       if (*ep != '\0')
-               goto out;
-
-       do_unmount(dev, fd);
-
-out:
-#endif
        close(fd);
 }