From 8b1045257ab46cd4b2570c8c61783ea5403ef547 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sat, 25 Nov 2006 05:54:42 +0000 Subject: [PATCH] 2006-11-25 Dan Williams * src/vpn-daemons/nm-vpn-service.c - (supplicant_child_setup): new function - (supplicant_exec): make child process use a new process group id * src/nm-device-802-11-wireless.c - (nm_vpn_service_child_setup): new function - (nm_vpn_service_stage1_daemon_exec): make child process use a new process group id git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2121 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 11 +++++++++++ src/nm-device-802-11-wireless.c | 20 ++++++++++++++++++-- src/vpn-manager/nm-vpn-service.c | 18 +++++++++++++++++- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ff0ad6894c..041329398a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-11-25 Dan Williams + + * src/vpn-daemons/nm-vpn-service.c + - (supplicant_child_setup): new function + - (supplicant_exec): make child process use a new process group id + + * src/nm-device-802-11-wireless.c + - (nm_vpn_service_child_setup): new function + - (nm_vpn_service_stage1_daemon_exec): make child process use a new + process group id + 2006-11-19 Dan Williams Patch from Dan Berrange Gnome.org #377262 diff --git a/src/nm-device-802-11-wireless.c b/src/nm-device-802-11-wireless.c index dd1b8f59e2..0f720740cd 100644 --- a/src/nm-device-802-11-wireless.c +++ b/src/nm-device-802-11-wireless.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "nm-device.h" #include "nm-device-802-11-wireless.h" @@ -2753,6 +2754,20 @@ supplicant_log_stdout (GIOChannel *ioc, GIOCondition condition, gpointer data) return retval; } +/* + * supplicant_child_setup + * + * Set the process group ID of the newly forked process + * + */ +static void +supplicant_child_setup (gpointer user_data G_GNUC_UNUSED) +{ + /* We are in the child process at this point */ + pid_t pid = getpid (); + setpgid (pid, pid); +} + static gboolean supplicant_exec (NMDevice80211Wireless *self) { @@ -2767,8 +2782,9 @@ supplicant_exec (NMDevice80211Wireless *self) argv[2] = WPA_SUPPLICANT_GLOBAL_SOCKET; argv[3] = NULL; - success = g_spawn_async_with_pipes ("/", argv, NULL, 0, NULL, NULL, - &pid, NULL, &sup_stdout, NULL, &error); + success = g_spawn_async_with_pipes ("/", argv, NULL, 0, + &supplicant_child_setup, NULL, &pid, NULL, &sup_stdout, + NULL, &error); if (!success) { if (error) diff --git a/src/vpn-manager/nm-vpn-service.c b/src/vpn-manager/nm-vpn-service.c index 3c764420c3..2f91138970 100644 --- a/src/vpn-manager/nm-vpn-service.c +++ b/src/vpn-manager/nm-vpn-service.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "NetworkManagerDbus.h" #include "nm-dbus-vpn.h" @@ -307,6 +308,21 @@ void nm_vpn_service_start_connection (NMVPNService *service, NMVPNActRequest *re } +/* + * nm_vpn_service_child_setup + * + * Set the process group ID of the newly forked process + * + */ +static void +nm_vpn_service_child_setup (gpointer user_data G_GNUC_UNUSED) +{ + /* We are in the child process at this point */ + pid_t pid = getpid (); + setpgid (pid, pid); +} + + /* * nm_vpn_service_stage_1_daemon_exec * @@ -341,7 +357,7 @@ static gboolean nm_vpn_service_stage1_daemon_exec (gpointer user_data) (char **) vpn_argv->pdata, NULL, 0, - NULL, + &nm_vpn_service_child_setup, NULL, &service->pid, &error);