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
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.
9
https://bugzilla.gnome.org/show_bug.cgi?id=710791
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)
19
+ GError *error = NULL;
23
@@ -526,15 +527,25 @@ run_custom_command (GdkDevice
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);
31
- g_warning ("Couldn't execute command '%s', verify that this is a valid command.", cmd);
33
+ g_warning ("Couldn't execute command '%s', verify that this is a valid command: %s", cmd, error->message);
34
+ g_clear_error (&error);
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);
46
+ g_clear_error (&error);