[Xfce4-commits] <exo:master> Lookup the hardcoded paths for (u)mount during configure (bug #3717).

Nick Schermer nick at xfce.org
Thu Aug 20 19:36:01 CEST 2009


Updating branch refs/heads/master
         to 05627cdb04d5d49d947f6acb7e3bbea26cfe5ec9 (commit)
       from c98c4d368f6a091d995c1d916b091f76ae4a5614 (commit)

commit 05627cdb04d5d49d947f6acb7e3bbea26cfe5ec9
Author: Nick Schermer <nick at xfce.org>
Date:   Thu Aug 20 19:23:51 2009 +0200

    Lookup the hardcoded paths for (u)mount during configure (bug #3717).

 configure.in.in             |    8 ++++++++
 exo-mount/Makefile.am       |    4 +++-
 exo-mount/exo-mount-fstab.c |   19 ++-----------------
 3 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/configure.in.in b/configure.in.in
index 8dd9bec..63bda89 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -94,6 +94,14 @@ AC_PROG_INTLTOOL([0.31], [no-xml])
 AC_PROG_LIBTOOL()
 AC_CHECK_PROGS([PERL], [perl5 perl])
 
+dnl ************************************************
+dnl *** Loopup hardcoded paths we use internally ***
+dnl ************************************************
+AC_PATH_PROG([PATH_MOUNT], [mount], [/bin/mount])
+AC_PATH_PROG([PATH_UMOUNT], [umount], [/bin/umount])
+AC_SUBST([PATH_MOUNT])
+AC_SUBST([PATH_UMOUNT])
+
 dnl ***************************************
 dnl *** Check for required Perl modules ***
 dnl ***************************************
diff --git a/exo-mount/Makefile.am b/exo-mount/Makefile.am
index cdff6d4..a44a46e 100644
--- a/exo-mount/Makefile.am
+++ b/exo-mount/Makefile.am
@@ -6,7 +6,9 @@ INCLUDES = 								\
 	-DG_LOG_DOMAIN=\"exo-mount\"					\
 	-DLIBEXECDIR=\"$(libexecdir)\"					\
 	-DLIBEXO_VERSION_API=\"$(LIBEXO_VERSION_API)\"			\
-	-DPACKAGE_LOCALE_DIR=\"$(localedir)\"
+	-DPACKAGE_LOCALE_DIR=\"$(localedir)\"				\
+	-DPATH_MOUNT=\"$(PATH_MOUNT)\"					\
+	-DPATH_UMOUNT=\"$(PATH_UMOUNT)\"
 
 bin_PROGRAMS =								\
 	exo-mount
diff --git a/exo-mount/exo-mount-fstab.c b/exo-mount/exo-mount-fstab.c
index bc6c84a..1164d81 100644
--- a/exo-mount/exo-mount-fstab.c
+++ b/exo-mount/exo-mount-fstab.c
@@ -36,13 +36,6 @@
 
 
 
-/* define _PATH_MOUNT if undefined */
-#ifndef _PATH_MOUNT
-#define _PATH_MOUNT "/bin/mount"
-#endif
-
-
-
 static gboolean exo_mount_fstab_exec   (const gchar *command,
                                         const gchar *argument,
                                         GError     **error);
@@ -242,7 +235,7 @@ exo_mount_fstab_mount (const gchar *device_file,
     return FALSE;
 
   /* try to mount the device */
-  result = exo_mount_fstab_exec (_PATH_MOUNT, mount_point, error);
+  result = exo_mount_fstab_exec (PATH_MOUNT, mount_point, error);
 
   /* cleanup */
   g_free (mount_point);
@@ -270,8 +263,6 @@ exo_mount_fstab_unmount (const gchar *device_file,
 {
   gboolean result;
   gchar   *mount_point;
-  gchar   *dirname;
-  gchar   *command;
 
   g_return_val_if_fail (g_path_is_absolute (device_file), FALSE);
   g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
@@ -281,17 +272,11 @@ exo_mount_fstab_unmount (const gchar *device_file,
   if (G_UNLIKELY (mount_point == NULL))
     return FALSE;
 
-  /* determine umount from _PATH_MOUNT */
-  dirname = g_path_get_dirname (_PATH_MOUNT);
-  command = g_build_filename (dirname, "umount", NULL);
-  g_free (dirname);
-
   /* try to mount the device */
-  result = exo_mount_fstab_exec (command, mount_point, error);
+  result = exo_mount_fstab_exec (PATH_UMOUNT, mount_point, error);
 
   /* cleanup */
   g_free (mount_point);
-  g_free (command);
 
   return result;
 }



More information about the Xfce4-commits mailing list