summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2014-09-09 13:32:46 +0200
committerJiří Klimeš <jklimes@redhat.com>2014-09-09 15:06:55 +0200
commitf945e222865cb14d018b1b5f502e69190d0f75f3 (patch)
tree14c2f5da9a5b7bcf56dbcc8431e4c1248cb8ea3c
parent29dd254a059c42e19f0e3ab22fb178c8217df881 (diff)
downloadNetworkManager-jk/bgo735962-dhcp-sigpipe.tar.gz
dhcp: let dhclient only log to syslog, redirect stdout,stderr to /dev/nulljk/bgo735962-dhcp-sigpipe
When NetworkManager is run with '--debug' we duplicate syslog to stderr. Redirect the outputs for dhcpcd, too.
-rw-r--r--src/dhcp-manager/nm-dhcp-dhclient.c10
-rw-r--r--src/dhcp-manager/nm-dhcp-dhcpcd.c3
2 files changed, 10 insertions, 3 deletions
diff --git a/src/dhcp-manager/nm-dhcp-dhclient.c b/src/dhcp-manager/nm-dhcp-dhclient.c
index 72e7cd033c..10621878b1 100644
--- a/src/dhcp-manager/nm-dhcp-dhclient.c
+++ b/src/dhcp-manager/nm-dhcp-dhclient.c
@@ -420,6 +420,11 @@ dhclient_start (NMDhcpClient *client,
g_ptr_array_add (argv, (gpointer) "-d");
+ /* Be quiet. dhclient logs to syslog anyway. And we duplicate the syslog
+ * to stderr in case of NM running with --debug.
+ */
+ g_ptr_array_add (argv, (gpointer) "-q");
+
if (release)
g_ptr_array_add (argv, (gpointer) "-r");
@@ -463,8 +468,9 @@ dhclient_start (NMDhcpClient *client,
nm_log_dbg (log_domain, "running: %s", cmd_str);
g_free (cmd_str);
- if (g_spawn_async (NULL, (char **) argv->pdata, NULL, G_SPAWN_DO_NOT_REAP_CHILD,
- &dhclient_child_setup, NULL, &pid, &error)) {
+ if (g_spawn_async (NULL, (char **) argv->pdata, NULL,
+ G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
+ &dhclient_child_setup, NULL, &pid, &error)) {
g_assert (pid > 0);
nm_log_info (log_domain, "dhclient started with pid %d", pid);
if (release == FALSE)
diff --git a/src/dhcp-manager/nm-dhcp-dhcpcd.c b/src/dhcp-manager/nm-dhcp-dhcpcd.c
index f8ab47f932..4b1bf0d5b5 100644
--- a/src/dhcp-manager/nm-dhcp-dhcpcd.c
+++ b/src/dhcp-manager/nm-dhcp-dhcpcd.c
@@ -159,7 +159,8 @@ ip4_start (NMDhcpClient *client,
nm_log_dbg (LOGD_DHCP4, "running: %s", cmd_str);
g_free (cmd_str);
- if (g_spawn_async (NULL, (char **) argv->pdata, NULL, G_SPAWN_DO_NOT_REAP_CHILD,
+ if (g_spawn_async (NULL, (char **) argv->pdata, NULL,
+ G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
&dhcpcd_child_setup, NULL, &pid, &error)) {
g_assert (pid > 0);
nm_log_info (LOGD_DHCP4, "dhcpcd started with pid %d", pid);