summaryrefslogtreecommitdiff
path: root/src/dnsmasq-manager
diff options
context:
space:
mode:
authorDan Winship <danw@redhat.com>2015-01-12 15:50:22 -0500
committerDan Winship <danw@redhat.com>2015-01-19 11:29:13 -0500
commitfb792af7cb5dde72b05e2312c2ce7d92aa29f34d (patch)
tree28fa91046c8e23a7a28eafea44393a1530072e69 /src/dnsmasq-manager
parentc22e3f327aac18c0b3f2ab76fc6b60fbb467d898 (diff)
downloadNetworkManager-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.c14
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;
}