diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-02-09 03:18:04 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-02-09 03:18:04 +0100 |
commit | 353e12c2f4a9e96a47eb80b80d2ffb7bc1d44a1b (patch) | |
tree | 0bd79a2c40d8d60892666affbbb89690f29c672e /src/execute.c | |
parent | 12ac304714996c3c3308d014b301d0d42d16c117 (diff) |
service: ignore SIGPIPE by defaultsystemd/v41
Diffstat (limited to 'src/execute.c')
-rw-r--r-- | src/execute.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/execute.c b/src/execute.c index 536877d68c..dab485682b 100644 --- a/src/execute.c +++ b/src/execute.c @@ -1038,8 +1038,11 @@ int exec_spawn(ExecCommand *command, default_signals(SIGNALS_CRASH_HANDLER, SIGNALS_IGNORE, -1); - if (sigemptyset(&ss) < 0 || - sigprocmask(SIG_SETMASK, &ss, NULL) < 0) { + if (context->ignore_sigpipe) + ignore_signals(SIGPIPE, -1); + + assert_se(sigemptyset(&ss) == 0); + if (sigprocmask(SIG_SETMASK, &ss, NULL) < 0) { err = -errno; r = EXIT_SIGNAL_MASK; goto fail_child; @@ -1528,6 +1531,7 @@ void exec_context_init(ExecContext *c) { c->kill_signal = SIGTERM; c->send_sigkill = true; c->control_group_persistent = -1; + c->ignore_sigpipe = true; } void exec_context_done(ExecContext *c) { @@ -1876,10 +1880,12 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) { fprintf(f, "%sKillMode: %s\n" "%sKillSignal: SIG%s\n" - "%sSendSIGKILL: %s\n", + "%sSendSIGKILL: %s\n" + "%sIgnoreSIGPIPE: %s\n", prefix, kill_mode_to_string(c->kill_mode), prefix, signal_to_string(c->kill_signal), - prefix, yes_no(c->send_sigkill)); + prefix, yes_no(c->send_sigkill), + prefix, yes_no(c->ignore_sigpipe)); if (c->utmp_id) fprintf(f, |