diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-05-31 23:55:55 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-06-10 01:28:58 +0200 |
commit | ce30c8dcb41dfe9264f79f30c7f51c0e74576638 (patch) | |
tree | 2d5c05e1225b43ec3d9870316899c1e87f7f381d /src/delta/delta.c | |
parent | signal-util: modernize and share more code (diff) | |
download | systemd-ce30c8dcb41dfe9264f79f30c7f51c0e74576638.tar.xz systemd-ce30c8dcb41dfe9264f79f30c7f51c0e74576638.zip |
tree-wide: whenever we fork off a foreign child process reset signal mask/handlers
Also, when the child is potentially long-running make sure to set a
death signal.
Also, ignore the result of the reset operations explicitly by casting
them to (void).
Diffstat (limited to 'src/delta/delta.c')
-rw-r--r-- | src/delta/delta.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/delta/delta.c b/src/delta/delta.c index c764bb4b46..b60aaef734 100644 --- a/src/delta/delta.c +++ b/src/delta/delta.c @@ -24,6 +24,7 @@ #include <string.h> #include <unistd.h> #include <getopt.h> +#include <sys/prctl.h> #include "hashmap.h" #include "util.h" @@ -34,6 +35,7 @@ #include "strv.h" #include "process-util.h" #include "terminal-util.h" +#include "signal-util.h" static const char prefixes[] = "/etc\0" @@ -189,9 +191,14 @@ static int found_override(const char *top, const char *bottom) { if (pid < 0) return log_error_errno(errno, "Failed to fork off diff: %m"); else if (pid == 0) { + + (void) reset_all_signal_handlers(); + (void) reset_signal_mask(); + assert_se(prctl(PR_SET_PDEATHSIG, SIGTERM) == 0); + execlp("diff", "diff", "-us", "--", bottom, top, NULL); log_error_errno(errno, "Failed to execute diff: %m"); - _exit(1); + _exit(EXIT_FAILURE); } wait_for_terminate_and_warn("diff", pid, false); |