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.
This commit is contained in:
Mike Yuan
2024-11-14 12:22:15 +00:00
committed by Luca Boccassi
parent 7eaf5ded61
commit c8590ad60d
+2 -2
View File
@@ -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. */