summaryrefslogtreecommitdiffstats
path: root/src/quotacheck
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-05-31 23:55:55 +0200
committerLennart Poettering <lennart@poettering.net>2015-06-10 01:28:58 +0200
commitce30c8dcb41dfe9264f79f30c7f51c0e74576638 (patch)
tree2d5c05e1225b43ec3d9870316899c1e87f7f381d /src/quotacheck
parentsignal-util: modernize and share more code (diff)
downloadsystemd-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/quotacheck')
-rw-r--r--src/quotacheck/quotacheck.c8
1 files changed, 8 insertions, 0 deletions
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 <stdbool.h>
#include <errno.h>
#include <unistd.h>
+#include <sys/prctl.h>
#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 */
}