Skip to content

Instantly share code, notes, and snippets.

@shulima
Last active August 29, 2015 14:17
Show Gist options
  • Save shulima/b1bfa6accd67c457d5c0 to your computer and use it in GitHub Desktop.
Save shulima/b1bfa6accd67c457d5c0 to your computer and use it in GitHub Desktop.
Replace Linux-specific fuse commands
diff --git a/fuse/guestunmount.c b/fuse/guestunmount.c
index 3df481b..94c3ec7 100644
--- a/fuse/guestunmount.c
+++ b/fuse/guestunmount.c
@@ -257,7 +257,12 @@ do_fusermount (const char *mountpoint, char **error_rtn)
/* We have to parse error messages from fusermount, so ... */
setenv ("LC_ALL", "C", 1);
+#ifdef __linux__
execlp ("fusermount", "fusermount", "-u", mountpoint, NULL);
+#else
+ /* use umount where fusermount is not available */
+ execlp ("umount", "umount", mountpoint, NULL);
+#endif
perror ("exec");
_exit (EXIT_FAILURE);
}
@@ -334,7 +339,11 @@ do_fuser (const char *mountpoint)
}
if (pid == 0) { /* Child - run /sbin/fuser. */
+#ifdef __linux__
execlp ("/sbin/fuser", "fuser", "-v", "-m", mountpoint, NULL);
+#else
+ execlp ("/sbin/fuser", "fuser", "-c", mountpoint, NULL);
+#endif
_exit (EXIT_FAILURE);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment