diff options
author | Dan Winship <danw@redhat.com> | 2015-01-12 15:50:22 -0500 |
---|---|---|
committer | Dan Winship <danw@redhat.com> | 2015-01-19 11:29:13 -0500 |
commit | fb792af7cb5dde72b05e2312c2ce7d92aa29f34d (patch) | |
tree | 28fa91046c8e23a7a28eafea44393a1530072e69 /src/dnsmasq-manager | |
parent | c22e3f327aac18c0b3f2ab76fc6b60fbb467d898 (diff) | |
download | NetworkManager-fb792af7cb5dde72b05e2312c2ce7d92aa29f34d.tar.gz |
core: add nm_utils_setpgid(), and use it
Add nm_utils_setpgid() as a g_spawn*() child setup function for
calling setpgid(), and use it where appropriate rather than
reimplementing it every time.
Diffstat (limited to 'src/dnsmasq-manager')
-rw-r--r-- | src/dnsmasq-manager/nm-dnsmasq-manager.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/dnsmasq-manager/nm-dnsmasq-manager.c b/src/dnsmasq-manager/nm-dnsmasq-manager.c index 7cf80907e2..a85631bcb1 100644 --- a/src/dnsmasq-manager/nm-dnsmasq-manager.c +++ b/src/dnsmasq-manager/nm-dnsmasq-manager.c @@ -296,14 +296,6 @@ create_dm_cmd_line (const char *iface, } static void -dm_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 void kill_existing_for_iface (const char *iface, const char *pidfile) { char *contents = NULL; @@ -367,9 +359,9 @@ nm_dnsmasq_manager_start (NMDnsMasqManager *manager, priv->pid = 0; if (!g_spawn_async (NULL, (char **) dm_cmd->array->pdata, NULL, - G_SPAWN_DO_NOT_REAP_CHILD, - dm_child_setup, - NULL, &priv->pid, error)) { + G_SPAWN_DO_NOT_REAP_CHILD, + nm_utils_setpgid, NULL, + &priv->pid, error)) { goto out; } |