[gnome-settings-daemon/gnome-3-4] common: Fix args generation for the custom cmd



commit 00681573ad6ebeb127ec72ac61d30d69be6459f8
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Apr 16 22:15:50 2012 +0100

    common: Fix args generation for the custom cmd
    
    https://bugzilla.gnome.org/show_bug.cgi?id=674222

 plugins/common/gsd-input-helper.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/plugins/common/gsd-input-helper.c b/plugins/common/gsd-input-helper.c
index 95b1b38..cf9e83d 100644
--- a/plugins/common/gsd-input-helper.c
+++ b/plugins/common/gsd-input-helper.c
@@ -433,7 +433,7 @@ run_custom_command (GdkDevice              *device,
 {
         GSettings *settings;
         char *cmd;
-        char *argv[5];
+        char *argv[7];
         int exit_status;
         gboolean rc;
         int id;
@@ -451,10 +451,12 @@ run_custom_command (GdkDevice              *device,
         g_object_get (device, "device-id", &id, NULL);
 
         argv[0] = cmd;
-        argv[1] = g_strdup_printf ("-t %s", custom_command_to_string (command));
-        argv[2] = g_strdup_printf ("-i %d", id);
-        argv[3] = g_strdup_printf ("%s", gdk_device_get_name (device));
-        argv[4] = NULL;
+        argv[1] = "-t";
+        argv[2] = (char *) custom_command_to_string (command);
+        argv[3] = "-i";
+        argv[4] = g_strdup_printf ("%d", id);
+        argv[5] = g_strdup_printf ("%s", gdk_device_get_name (device));
+        argv[6] = NULL;
 
         rc = g_spawn_sync (g_get_home_dir (), argv, NULL, G_SPAWN_SEARCH_PATH,
                            NULL, NULL, NULL, NULL, &exit_status, NULL);
@@ -463,8 +465,8 @@ run_custom_command (GdkDevice              *device,
                 g_warning ("Couldn't execute command '%s', verify that this is a valid command.", cmd);
 
         g_free (argv[0]);
-        g_free (argv[1]);
-        g_free (argv[2]);
+        g_free (argv[4]);
+        g_free (argv[5]);
 
         return (exit_status == 0);
 }



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