From 2905402c0b856eaf86e497c41bbe0d630647c6f6 Mon Sep 17 00:00:00 2001 From: raveit Date: Tue, 5 Feb 2013 10:54:42 +0100 Subject: Avoid-double-forking-when-launching-apps-it-breaks --- mate-panel/panel-run-dialog.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'mate-panel/panel-run-dialog.c') diff --git a/mate-panel/panel-run-dialog.c b/mate-panel/panel-run-dialog.c index f476b5de..339240d2 100644 --- a/mate-panel/panel-run-dialog.c +++ b/mate-panel/panel-run-dialog.c @@ -349,6 +349,17 @@ command_is_executable (const char *command, return TRUE; } +static void +dummy_child_watch (GPid pid, + gint status, + gpointer user_data) +{ + /* Nothing, this is just to ensure we don't double fork + * and break pkexec: + * https://bugzilla.gnome.org/show_bug.cgi?id=675789 + */ +} + static gboolean panel_run_dialog_launch_command (PanelRunDialog *dialog, const char *command, @@ -359,6 +370,7 @@ panel_run_dialog_launch_command (PanelRunDialog *dialog, GError *error = NULL; char **argv; int argc; + GPid pid; if (!command_is_executable (locale_command, &argc, &argv)) return FALSE; @@ -372,10 +384,10 @@ panel_run_dialog_launch_command (PanelRunDialog *dialog, NULL, /* working directory */ argv, NULL, /* envp */ - G_SPAWN_SEARCH_PATH, + G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, NULL, /* child setup func */ NULL, /* user data */ - NULL, /* child pid */ + &pid, /* child pid */ &error); if (!result) { @@ -389,6 +401,8 @@ panel_run_dialog_launch_command (PanelRunDialog *dialog, g_free (primary); g_error_free (error); + } else { + g_child_watch_add (pid, dummy_child_watch, NULL); } g_strfreev (argv); -- cgit v1.2.1