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/systemctl/systemctl.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/systemctl/systemctl.c') diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index b3d90d2c33..5075e4e176 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -5189,6 +5189,9 @@ static int enable_sysv_units(const char *verb, char **args) { else if (pid == 0) { /* Child */ + (void) reset_all_signal_handlers(); + (void) reset_signal_mask(); + execv(argv[0], (char**) argv); log_error("Failed to execute %s: %m", argv[0]); _exit(EXIT_FAILURE); @@ -5854,6 +5857,9 @@ static int run_editor(char **paths) { unsigned i = 1; size_t argc; + (void) reset_all_signal_handlers(); + (void) reset_signal_mask(); + argc = strv_length(paths)/2 + 1; args = newa(const char*, argc + 1); -- cgit v1.2.3-54-g00ecf