Merge lp:~robert-ancell/unity-settings-daemon/check-exit-status into lp:unity-settings-daemon

Proposed by Robert Ancell
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 4045
Merged at revision: 4047
Proposed branch: lp:~robert-ancell/unity-settings-daemon/check-exit-status
Merge into: lp:unity-settings-daemon
Diff against target: 41 lines (+15/-4)
1 file modified
plugins/common/gsd-input-helper.c (+15/-4)
To merge this branch: bzr merge lp:~robert-ancell/unity-settings-daemon/check-exit-status
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+226622@code.launchpad.net

Commit message

common: Check the exit status of hotplug scripts correctly

Instead of comparing the shell's exit code by hand, use
g_spawn_check_exit_status() to get the script's exit code.

https://bugzilla.gnome.org/show_bug.cgi?id=710791

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/common/gsd-input-helper.c'
2--- plugins/common/gsd-input-helper.c 2014-06-04 09:43:40 +0000
3+++ plugins/common/gsd-input-helper.c 2014-07-14 00:02:55 +0000
4@@ -504,6 +504,7 @@
5 CustomCommand command)
6 {
7 GSettings *settings;
8+ GError *error = NULL;
9 char *cmd;
10 char *argv[7];
11 int exit_status;
12@@ -531,15 +532,25 @@
13 argv[6] = NULL;
14
15 rc = g_spawn_sync (g_get_home_dir (), argv, NULL, G_SPAWN_SEARCH_PATH,
16- NULL, NULL, NULL, NULL, &exit_status, NULL);
17+ NULL, NULL, NULL, NULL, &exit_status, &error);
18
19- if (rc == FALSE)
20- g_warning ("Couldn't execute command '%s', verify that this is a valid command.", cmd);
21+ if (rc == FALSE) {
22+ g_warning ("Couldn't execute command '%s', verify that this is a valid command: %s", cmd, error->message);
23+ g_clear_error (&error);
24+ }
25
26 g_free (argv[0]);
27 g_free (argv[4]);
28
29- return (exit_status == 1);
30+ if (!g_spawn_check_exit_status (exit_status, &error)) {
31+ if (g_error_matches (error, G_SPAWN_EXIT_ERROR, 1)) {
32+ g_clear_error (&error);
33+ return TRUE;
34+ }
35+ g_clear_error (&error);
36+ }
37+
38+ return FALSE;
39 }
40
41 GList *

Subscribers

People subscribed via source and target branches