diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-12-29 18:01:37 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-01-04 13:27:27 +0100 |
commit | 1f5d1e02478fb550c926b23597895c7f1745dd9f (patch) | |
tree | db93092f43f5a5ce7356bc6d9ab8faf013080879 /src/quotacheck | |
parent | exec-util: drop redundant log message in do_spawn() (diff) | |
download | systemd-1f5d1e02478fb550c926b23597895c7f1745dd9f.tar.xz systemd-1f5d1e02478fb550c926b23597895c7f1745dd9f.zip |
process-spec: add another flag FORK_WAIT to safe_fork()
This new flag will cause safe_fork() to wait for the forked off child
before returning. This allows us to unify a number of cases where we
immediately wait on the forked off child, witout running any code in the
parent after the fork, and without direct interest in the precise exit
status of the process, except recgonizing EXIT_SUCCESS vs everything
else.
Diffstat (limited to 'src/quotacheck')
-rw-r--r-- | src/quotacheck/quotacheck.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/quotacheck/quotacheck.c b/src/quotacheck/quotacheck.c index c40c7d5d07..1bf718e4f6 100644 --- a/src/quotacheck/quotacheck.c +++ b/src/quotacheck/quotacheck.c @@ -71,14 +71,6 @@ static void test_files(void) { } int main(int argc, char *argv[]) { - - static const char * const cmdline[] = { - QUOTACHECK, - "-anug", - NULL - }; - - pid_t pid; int r; if (argc > 1) { @@ -106,10 +98,15 @@ int main(int argc, char *argv[]) { return EXIT_SUCCESS; } - r = safe_fork("(quotacheck)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG, &pid); + r = safe_fork("(quotacheck)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG|FORK_WAIT, NULL); if (r < 0) goto finish; if (r == 0) { + static const char * const cmdline[] = { + QUOTACHECK, + "-anug", + NULL + }; /* Child */ @@ -117,8 +114,6 @@ int main(int argc, char *argv[]) { _exit(EXIT_FAILURE); /* Operational error */ } - r = wait_for_terminate_and_check("quotacheck", pid, WAIT_LOG); - finish: return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; } |