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

Nick Schermer nick at xfce.org
Thu Aug 20 20:40:05 CEST 2009


Updating branch refs/heads/xfce-4.6
         to 36563a3374ec1fc574ef682ea068ad3cb24ae84a (commit)
       from 979fec5a7f81fd8ae3eec45906eb7c165052aaa6 (commit)

commit 36563a3374ec1fc574ef682ea068ad3cb24ae84a
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 3926d81..7b568d0 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -93,6 +93,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 87f8cf4..1851fd7 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