build: check the path of fuser, and use it in FUSE code

Check for the full path of fuser, and use it instead of hardcoding
/sbin/fuser (which is still left as fallback).
This commit is contained in:
Pino Toscano
2016-03-18 11:37:32 +01:00
parent 5897b3bbad
commit 7e970fcdb3
3 changed files with 8 additions and 4 deletions

View File

@@ -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);
}

View File

@@ -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));

View File

@@ -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.])