[network-manager-applet/NMA_0_8] applet: ensure VPN auth dialog process group separation (bgo #647726) (rh #540771) (lp:655003)



commit a69759d3fad428e6913e90d4fc6a7daf4da3af2d
Author: Dan Williams <dcbw redhat com>
Date:   Wed Apr 13 22:46:23 2011 -0500

    applet: ensure VPN auth dialog process group separation (bgo #647726) (rh #540771) (lp:655003)
    
    Like most other times we spawn things, make sure it gets its own
    process group so the applet isn't taken down when bad things happen
    to the child.

 src/vpn-password-dialog.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/vpn-password-dialog.c b/src/vpn-password-dialog.c
index ce5214d..e714f87 100644
--- a/src/vpn-password-dialog.c
+++ b/src/vpn-password-dialog.c
@@ -164,6 +164,14 @@ destroy_gvalue (gpointer data)
 	g_slice_free (GValue, value);
 }
 
+static void
+vpn_child_setup (gpointer user_data G_GNUC_UNUSED)
+{
+	/* We are in the child process at this point */
+	pid_t pid = getpid ();
+	setpgid (pid, pid);
+}
+
 gboolean
 nma_vpn_request_password (NMSettingsConnectionInterface *connection_iface,
                           gboolean retry,
@@ -237,7 +245,7 @@ nma_vpn_request_password (NMSettingsConnectionInterface *connection_iface,
 				       (gchar **) argv,            /* argv */
 				       NULL,                       /* envp */
 				       G_SPAWN_DO_NOT_REAP_CHILD,  /* flags */
-				       NULL,                       /* child_setup */
+				       vpn_child_setup,            /* child_setup */
 				       NULL,                       /* user_data */
 				       &child_pid,                 /* child_pid */
 				       &child_stdin,               /* standard_input */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]