~darkxst/ubuntu/utopic/gnome-settings-daemon/lp1372346

« back to all changes in this revision

Viewing changes to debian/patches/git_lp1339244.patch

  • Committer: Robert Ancell
  • Date: 2014-07-14 00:01:03 UTC
  • Revision ID: robert.ancell@canonical.com-20140714000103-bpi6260ohci95d30
* debian/patches/git_lp1339244.patch:
  - fix exit status check in gsd-input-helper.c (LP: #1339244)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From 2329da7dad28f61109cecd8ca8ce93580f62f349 Mon Sep 17 00:00:00 2001
 
2
From: Bastien Nocera <hadess@hadess.net>
 
3
Date: Fri, 25 Apr 2014 15:42:39 +0200
 
4
Subject: common: Check the exit status of hotplug scripts correctly
 
5
 
 
6
Instead of comparing the shell's exit code by hand, use
 
7
g_spawn_check_exit_status() to get the script's exit code.
 
8
 
 
9
https://bugzilla.gnome.org/show_bug.cgi?id=710791
 
10
 
 
11
Index: gnome-settings-daemon-3.8.6.1/plugins/common/gsd-input-helper.c
 
12
===================================================================
 
13
--- gnome-settings-daemon-3.8.6.1.orig/plugins/common/gsd-input-helper.c
 
14
+++ gnome-settings-daemon-3.8.6.1/plugins/common/gsd-input-helper.c
 
15
@@ -499,6 +499,7 @@ run_custom_command (GdkDevice
 
16
                     CustomCommand           command)
 
17
 {
 
18
         GSettings *settings;
 
19
+        GError *error = NULL;
 
20
         char *cmd;
 
21
         char *argv[7];
 
22
         int exit_status;
 
23
@@ -526,15 +527,25 @@ run_custom_command (GdkDevice
 
24
         argv[6] = NULL;
 
25
 
 
26
         rc = g_spawn_sync (g_get_home_dir (), argv, NULL, G_SPAWN_SEARCH_PATH,
 
27
-                           NULL, NULL, NULL, NULL, &exit_status, NULL);
 
28
+                           NULL, NULL, NULL, NULL, &exit_status, &error);
 
29
 
 
30
-        if (rc == FALSE)
 
31
-                g_warning ("Couldn't execute command '%s', verify that this is a valid command.", cmd);
 
32
+        if (rc == FALSE) {
 
33
+                g_warning ("Couldn't execute command '%s', verify that this is a valid command: %s", cmd, error->message);
 
34
+                g_clear_error (&error);
 
35
+        }
 
36
 
 
37
         g_free (argv[0]);
 
38
         g_free (argv[4]);
 
39
 
 
40
-        return (exit_status == 1);
 
41
+        if (!g_spawn_check_exit_status (exit_status, &error)) {
 
42
+                if (g_error_matches (error, G_SPAWN_EXIT_ERROR, 1)) {
 
43
+                        g_clear_error (&error);
 
44
+                        return TRUE;
 
45
+                }
 
46
+                g_clear_error (&error);
 
47
+        }
 
48
+
 
49
+        return FALSE;
 
50
 }
 
51
 
 
52
 GList *