Check for the full path of fuser, and use it instead of hardcoding
/sbin/fuser (which is still left as fallback).
---
fuse/guestunmount.c | 6 +++---
fuse/test-fuse.c | 2 +-
m4/guestfs_progs.m4 | 4 ++++
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/fuse/guestunmount.c b/fuse/guestunmount.c
index fa6d5bb..8be9876 100644
--- a/fuse/guestunmount.c
+++ b/fuse/guestunmount.c
@@ -348,11 +348,11 @@ do_fuser (const char *mountpoint)
exit (EXIT_FAILURE);
}
- if (pid == 0) { /* Child - run /sbin/fuser. */
+ if (pid == 0) { /* Child - run fuser. */
#ifdef __linux__
- execlp ("/sbin/fuser", "fuser", "-v", "-m",
mountpoint, NULL);
+ execlp (FUSER, "fuser", "-v", "-m", mountpoint, NULL);
#else
- execlp ("/sbin/fuser", "fuser", "-c", mountpoint,
NULL);
+ execlp (FUSER, "fuser", "-c", mountpoint, NULL);
#endif
_exit (EXIT_FAILURE);
}
diff --git a/fuse/test-fuse.c b/fuse/test-fuse.c
index 41ee947..95a2b3d 100644
--- a/fuse/test-fuse.c
+++ b/fuse/test-fuse.c
@@ -148,7 +148,7 @@ main (int argc, char *argv[])
ignore_value (chdir ("/"));
/* Who's using the mountpoint? Should be no one. */
- snprintf (cmd, sizeof cmd, "/sbin/fuser %s", mountpoint);
+ snprintf (cmd, sizeof cmd, "%s %s", FUSER, mountpoint);
printf ("%s\n", cmd);
fflush (stdout);
ignore_value (system (cmd));
diff --git a/m4/guestfs_progs.m4 b/m4/guestfs_progs.m4
index d4d1c34..0546b29 100644
--- a/m4/guestfs_progs.m4
+++ b/m4/guestfs_progs.m4
@@ -132,3 +132,7 @@ AS_IF([test "x$VALGRIND" != "xno"],[
])
AC_SUBST([VG])
AM_SUBST_NOTMAKE([VG])
+
+dnl Check for fuser (used in FUSE stuff).
+AC_PATH_PROGS([FUSER],[fuser],[/sbin/fuser])
+AC_DEFINE_UNQUOTED([FUSER],["$FUSER"],[Name of fuser program.])
--
2.5.0