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



commit fbefed16b20fbf5217437933e5a57676dd24fd0c
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/applet-vpn-request.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/applet-vpn-request.c b/src/applet-vpn-request.c
index a6549df..845f08a 100644
--- a/src/applet-vpn-request.c
+++ b/src/applet-vpn-request.c
@@ -330,6 +330,14 @@ write_connection_to_child (int fd, NMConnection *connection, GError **error)
 	return TRUE;
 }
 
+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
 applet_vpn_request_get_secrets (SecretsRequest *req, GError **error)
 {
@@ -392,7 +400,7 @@ applet_vpn_request_get_secrets (SecretsRequest *req, GError **error)
 	                               (gchar **) argv,            /* argv */
 	                               NULL,                       /* envp */
 	                               G_SPAWN_DO_NOT_REAP_CHILD,  /* flags */
-	                               NULL,                       /* child_setup */
+	                               vpn_child_setup,            /* child_setup */
 	                               NULL,                       /* user_data */
 	                               &priv->pid,                 /* child_pid */
 	                               &priv->child_stdin,         /* standard_input */



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