diff options
author | Mike Yuan <me@yhndnzj.com> | 2024-11-11 19:38:36 +0100 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2024-11-14 13:22:15 +0100 |
commit | c8590ad60d17b8354d6c8e3f79b1de50abac919a (patch) | |
tree | b17f2316272189093f167a33f79847d23dd06ec7 /src | |
parent | async: block SIGTERM in asynchronous_rm_rf() (diff) | |
download | systemd-c8590ad60d17b8354d6c8e3f79b1de50abac919a.tar.xz systemd-c8590ad60d17b8354d6c8e3f79b1de50abac919a.zip |
process-util: refuse FORK_DETACH + FORK_DEATHSIG_*
There's no synchoronization between the intermediate process
and the double-forked child, and the semantics are not useful.
Refuse such combination.
Diffstat (limited to 'src')
-rw-r--r-- | src/basic/process-util.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c index 9c159b4605..adc576a84f 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -1460,8 +1460,8 @@ int safe_fork_full( bool block_signals = false, block_all = false, intermediary = false; int prio, r; - assert(!FLAGS_SET(flags, FORK_DETACH) || !ret_pid); - assert(!FLAGS_SET(flags, FORK_DETACH|FORK_WAIT)); + assert(!FLAGS_SET(flags, FORK_DETACH) || + (!ret_pid && (flags & (FORK_WAIT|FORK_DEATHSIG_SIGTERM|FORK_DEATHSIG_SIGINT|FORK_DEATHSIG_SIGKILL)) == 0)); /* A wrapper around fork(), that does a couple of important initializations in addition to mere forking. Always * returns the child's PID in *ret_pid. Returns == 0 in the child, and > 0 in the parent. */ |