diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2016-11-10 14:59:37 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2016-11-18 14:45:33 +0100 |
commit | a6d34f9ae348603eebc1e53067c164ab352293d3 (patch) | |
tree | bf18542af650c63707abba02aa5b1f4fc4a5a7cb /src/devices/team | |
parent | cb61dd113c8f2209e4dca96134c91b40d2cefccb (diff) | |
download | NetworkManager-a6d34f9ae348603eebc1e53067c164ab352293d3.tar.gz |
team: ignore SIGPIPE when spawning teamd
With systemd < 219, restarting the journald service closes the stdout
and stderr streams associated with services.
The NM process has SIGPIPE ignored, but g_spawn_sync()/g_spawn_async()
re-enable it and so any child executed with those functions will
terminate by default if it tries to log anything to stdout/stderr.
The teamd instance launched by NM is affected by this problem since it
writes debug messages before actually ignoring SIGPIPE.
To fix this, use the @child_setup callback of g_spawn() to ignore
again SIGPIPE in the child process.
https://bugzilla.redhat.com/show_bug.cgi?id=1393853
Diffstat (limited to 'src/devices/team')
-rw-r--r-- | src/devices/team/nm-device-team.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c index 07ed092cba..ab195c886a 100644 --- a/src/devices/team/nm-device-team.c +++ b/src/devices/team/nm-device-team.c @@ -480,6 +480,13 @@ teamd_process_watch_cb (GPid pid, gint status, gpointer user_data) } } +static void +teamd_child_setup (gpointer user_data) +{ + nm_utils_setpgid (NULL); + signal (SIGPIPE, SIG_IGN); +} + static gboolean teamd_kill (NMDeviceTeam *self, const char *teamd_binary, GError **error) { @@ -502,7 +509,7 @@ teamd_kill (NMDeviceTeam *self, const char *teamd_binary, GError **error) g_ptr_array_add (argv, NULL); _LOGD (LOGD_TEAM, "running: %s", (tmp_str = g_strjoinv (" ", (gchar **) argv->pdata))); - return g_spawn_sync ("/", (char **) argv->pdata, NULL, 0, NULL, NULL, NULL, NULL, NULL, error); + return g_spawn_sync ("/", (char **) argv->pdata, NULL, 0, teamd_child_setup, NULL, NULL, NULL, NULL, error); } static gboolean @@ -553,7 +560,7 @@ teamd_start (NMDevice *device, NMSettingTeam *s_team) _LOGD (LOGD_TEAM, "running: %s", (tmp_str = g_strjoinv (" ", (gchar **) argv->pdata))); if (!g_spawn_async ("/", (char **) argv->pdata, NULL, G_SPAWN_DO_NOT_REAP_CHILD, - nm_utils_setpgid, NULL, &priv->teamd_pid, &error)) { + teamd_child_setup, NULL, &priv->teamd_pid, &error)) { _LOGW (LOGD_TEAM, "Activation: (team) failed to start teamd: %s", error->message); teamd_cleanup (device, TRUE); return FALSE; |