2006-11-25 Dan Williams <dcbw@redhat.com>

* 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
This commit is contained in:
Dan Williams 2006-11-25 05:54:42 +00:00
parent edf848e10d
commit 8b1045257a
3 changed files with 46 additions and 3 deletions

View file

@ -1,3 +1,14 @@
2006-11-25 Dan Williams <dcbw@redhat.com>
* 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 <dcbw@redhat.com>
Patch from Dan Berrange <dan@berrange.com> Gnome.org #377262

View file

@ -29,6 +29,7 @@
#include <sys/stat.h>
#include <sys/wait.h>
#include <signal.h>
#include <unistd.h>
#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)

View file

@ -27,6 +27,7 @@
#include <dbus/dbus.h>
#include <sys/types.h>
#include <signal.h>
#include <unistd.h>
#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);