[gnome-packagekit] Do not hardcode /usr/libexec as libexecdir



commit 091422327055eb4d4d177f3b310a0234b075daba
Author: Vincent Untz <vuntz gnome org>
Date:   Thu Oct 7 16:50:41 2010 +0200

    Do not hardcode /usr/libexec as libexecdir
    
    Note that this makes the code for gpk_dbus_task_path_is_trusted() a bit
    more complex since we can't assume $(libexecdir) will be /usr/libexec or
    /usr/libexec/, and that will cause issues when comparing strings.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=628962

 src/Makefile.am     |    1 +
 src/gpk-dbus-task.c |   17 +++++++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 9081050..880f596 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,6 +23,7 @@ INCLUDES =						\
 	-DPREFIX=\""$(prefix)"\" 			\
 	-DSYSCONFDIR=\""$(sysconfdir)"\" 		\
 	-DLIBDIR=\""$(libdir)"\" 			\
+	-DLIBEXECDIR=\""$(libexecdir)"\" 		\
 	-DLOCALEDIR=\""$(localedir)"\"			\
 	-DVERSION="\"$(VERSION)\"" 			\
 	-DGPK_DATA=\"$(pkgdatadir)\"			\
diff --git a/src/gpk-dbus-task.c b/src/gpk-dbus-task.c
index ab01a26..368f056 100644
--- a/src/gpk-dbus-task.c
+++ b/src/gpk-dbus-task.c
@@ -2962,11 +2962,20 @@ out:
 static gboolean
 gpk_dbus_task_path_is_trusted (const gchar *exec)
 {
+	gboolean res = FALSE;
+	gchar *path;
+
 	/* special case the plugin helper -- it's trusted */
-	if (g_strcmp0 (exec, "/usr/libexec/gst-install-plugins-helper") == 0 ||
-	    g_strcmp0 (exec, "/usr/libexec/pk-gstreamer-install") == 0)
-		return TRUE;
-	return FALSE;
+
+	path = g_build_filename (LIBEXECDIR, "gst-install-plugins-helper", NULL);
+	res = res || (g_strcmp0 (exec, path) == 0);
+	g_free (path);
+
+	path = g_build_filename (LIBEXECDIR, "pk-gstreamer-install", NULL);
+	res = res || (g_strcmp0 (exec, path) == 0);
+	g_free (path);
+
+	return res;
 }
 
 /**



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]