From ce30c8dcb41dfe9264f79f30c7f51c0e74576638 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 31 May 2015 23:55:55 +0200 Subject: 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). --- src/quotacheck/quotacheck.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/quotacheck/quotacheck.c') diff --git a/src/quotacheck/quotacheck.c b/src/quotacheck/quotacheck.c index a729f592cf..cf6a239402 100644 --- a/src/quotacheck/quotacheck.c +++ b/src/quotacheck/quotacheck.c @@ -23,9 +23,11 @@ #include #include #include +#include #include "util.h" #include "process-util.h" +#include "signal-util.h" static bool arg_skip = false; static bool arg_force = false; @@ -105,7 +107,13 @@ int main(int argc, char *argv[]) { log_error_errno(errno, "fork(): %m"); return EXIT_FAILURE; } else if (pid == 0) { + /* Child */ + + (void) reset_all_signal_handlers(); + (void) reset_signal_mask(); + assert_se(prctl(PR_SET_PDEATHSIG, SIGTERM) == 0); + execv(cmdline[0], (char**) cmdline); _exit(1); /* Operational error */ } -- cgit v1.2.3-54-g00ecf