From 96bc6e532df0611fb12fdcb4ccb346a248461d58 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 18 Jun 2014 15:33:39 -0500 Subject: If we try to prompt for confirmation with zenity but zenity fails to run, treat that as confirmation. Otherwise how will a user ever log out? --- src/backend-dbus/actions.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/backend-dbus') diff --git a/src/backend-dbus/actions.c b/src/backend-dbus/actions.c index 503f1b8..5447440 100644 --- a/src/backend-dbus/actions.c +++ b/src/backend-dbus/actions.c @@ -669,6 +669,7 @@ zenity_question (IndicatorSessionActionsDbus * self, { char * command_line; int exit_status; + GError * error; gboolean confirmed; command_line = g_strdup_printf ("%s" @@ -686,11 +687,16 @@ zenity_question (IndicatorSessionActionsDbus * self, ok_label, cancel_label); + /* Treat errors as user confirmation. + Otherwise how will the user ever log out? */ exit_status = -1; - if (!g_spawn_command_line_sync (command_line, NULL, NULL, &exit_status, NULL)) + error = NULL; + if (!g_spawn_command_line_sync (command_line, NULL, NULL, &exit_status, &error)) + { + confirmed = TRUE; + } + else if (!g_spawn_check_exit_status (exit_status, &error)) { - /* Treat failure-to-prompt as user confirmation. - Otherwise how will the user ever log out? */ confirmed = TRUE; } else @@ -698,6 +704,7 @@ zenity_question (IndicatorSessionActionsDbus * self, confirmed = exit_status == 0; } + log_and_clear_error (&error, G_STRLOC, G_STRFUNC); g_free (command_line); return confirmed; } -- cgit v1.2.3