summary refs log tree commit diff stats
path: root/src/fe-gtk
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2014-04-25 13:41:38 -0400
committerTingPing <tingping@fedoraproject.org>2014-06-04 10:38:23 -0400
commit5849a0588e7b12003f8b9afcfcdc31f46c6b2329 (patch)
tree0eb7fa462318506be8b4303a9b32cb6a888c47cf /src/fe-gtk
parentb8c02f71d9bbaf805534d5327d8c3935a3b87636 (diff)
Use glib to parse and launch commands for util_exec
Fixes #958
Diffstat (limited to 'src/fe-gtk')
-rw-r--r--src/fe-gtk/menu.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/fe-gtk/menu.c b/src/fe-gtk/menu.c
index 39c0ad5a..c37fbc8e 100644
--- a/src/fe-gtk/menu.c
+++ b/src/fe-gtk/menu.c
@@ -403,8 +403,10 @@ toggle_cb (GtkWidget *item, char *pref_name)
 static int
 is_in_path (char *cmd)
 {
-	char *prog = strdup (cmd + 1);	/* 1st char is "!" */
+	char *prog = g_strdup (cmd + 1);	/* 1st char is "!" */
 	char *space, *path, *orig;
+	char **argv;
+	int argc;
 
 	orig = prog; /* save for free()ing */
 	/* special-case these default entries. */
@@ -413,16 +415,17 @@ is_in_path (char *cmd)
 	/* don't check for gnome-terminal, but the thing it's executing! */
 		prog += 18;
 
-	space = strchr (prog, ' ');	/* this isn't 100% but good enuf */
-	if (space)
-		*space = 0;
-
-	path = g_find_program_in_path (prog);
-	if (path)
+	if (g_shell_parse_argv (prog, &argc, &argv, NULL))
 	{
-		g_free (path);
-		g_free (orig);
-		return 1;
+		path = g_find_program_in_path (argv[0]);
+		if (path)
+		{
+			g_free (path);
+			g_free (orig);
+			g_strfreev (argv);
+			return 1;
+		}
+		g_strfreev (argv);
 	}
 
 	g_free (orig);