[systemd-devel] [PATCH] build: lookup for the "mount" binary

Tom Gundersen teg at jklm.no
Wed Oct 30 19:18:48 CET 2013


On Wed, Oct 30, 2013 at 7:12 PM, Cristian Rodríguez
<crrodriguez at opensuse.org> wrote:
> Real executable might be in /usr and not in /bin

I'm not against the patch, but the justification seems lacking... Does
anyone actually do this? I.e., have a mount that is not symlinked to
by /bin/mount?

-t

> ---
>  configure.ac                |  4 ++++
>  src/core/mount.c            |  4 ++--
>  src/remount-fs/remount-fs.c | 10 +++++-----
>  3 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 7e41d57..8ad3c43 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -78,6 +78,10 @@ AC_PATH_PROG([KMOD], [kmod], [/usr/bin/kmod])
>
>  AC_PATH_PROG([KEXEC], [kexec], [/usr/sbin/kexec])
>
> +AC_PATH_PROG([MOUNT_BIN], [mount], [/bin/mount])
> +AC_DEFINE_UNQUOTED(MOUNT_BIN, ["$MOUNT_BIN"], [Path to /bin/mount])
> +
> +
>  # gtkdocize greps for '^GTK_DOC_CHECK', so it needs to be on its own line
>  m4_ifdef([GTK_DOC_CHECK], [
>  GTK_DOC_CHECK([1.18],[--flavour no-tmpl])],
> diff --git a/src/core/mount.c b/src/core/mount.c
> index 88563b3..69c932b 100644
> --- a/src/core/mount.c
> +++ b/src/core/mount.c
> @@ -915,7 +915,7 @@ static void mount_enter_mounting(Mount *m) {
>          if (m->from_fragment)
>                  r = exec_command_set(
>                                  m->control_command,
> -                                "/bin/mount",
> +                                MOUNT_BIN,
>                                  m->parameters_fragment.what,
>                                  m->where,
>                                  "-t", m->parameters_fragment.fstype ? m->parameters_fragment.fstype : "auto",
> @@ -974,7 +974,7 @@ static void mount_enter_remounting(Mount *m) {
>
>                  r = exec_command_set(
>                                  m->control_command,
> -                                "/bin/mount",
> +                                MOUNT_BIN,
>                                  m->parameters_fragment.what,
>                                  m->where,
>                                  "-t", m->parameters_fragment.fstype ? m->parameters_fragment.fstype : "auto",
> diff --git a/src/remount-fs/remount-fs.c b/src/remount-fs/remount-fs.c
> index 847637a..c1fc78b 100644
> --- a/src/remount-fs/remount-fs.c
> +++ b/src/remount-fs/remount-fs.c
> @@ -96,15 +96,15 @@ int main(int argc, char *argv[]) {
>                          const char *arguments[5];
>                          /* Child */
>
> -                        arguments[0] = "/bin/mount";
> +                        arguments[0] = MOUNT_BIN;
>                          arguments[1] = me->mnt_dir;
>                          arguments[2] = "-o";
>                          arguments[3] = "remount";
>                          arguments[4] = NULL;
>
> -                        execv("/bin/mount", (char **) arguments);
> +                        execv(MOUNT_BIN, (char **) arguments);
>
> -                        log_error("Failed to execute /bin/mount: %m");
> +                        log_error("Failed to execute %s: %m", MOUNT_BIN);
>                          _exit(EXIT_FAILURE);
>                  }
>
> @@ -144,9 +144,9 @@ int main(int argc, char *argv[]) {
>                  if (s) {
>                          if (!is_clean_exit(si.si_code, si.si_status, NULL)) {
>                                  if (si.si_code == CLD_EXITED)
> -                                        log_error("/bin/mount for %s exited with exit status %i.", s, si.si_status);
> +                                        log_error("%s for %s exited with exit status %i.", MOUNT_BIN, s, si.si_status);
>                                  else
> -                                        log_error("/bin/mount for %s terminated by signal %s.", s, signal_to_string(si.si_status));
> +                                        log_error("%s for %s terminated by signal %s.", MOUNT_BIN, s, signal_to_string(si.si_status));
>
>                                  ret = EXIT_FAILURE;
>                          }
> --
> 1.8.4
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list