1
0
mirror of https://passt.top/passt synced 2024-06-23 11:37:04 +00:00

pasta: correctly exit when execvp() fails

By default clone() will create a child that does not send SIGCHLD when
the child exits. The caller has to specifiy the SIGNAL it should get in
the flag bitmask.
see clone(2) under "The child termination signal"

This fixes the problem where pasta would not exit when the execvp()
call failed, i.e. when the command does not exists.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Paul Holzinger 2023-02-08 16:54:40 +01:00 committed by Stefano Brivio
parent 3487b5fc93
commit 04dfc5b81f

View File

@ -241,7 +241,7 @@ void pasta_start_ns(struct ctx *c, uid_t uid, gid_t gid,
pasta_child_pid = do_clone(pasta_spawn_cmd, ns_fn_stack,
sizeof(ns_fn_stack),
CLONE_NEWIPC | CLONE_NEWPID | CLONE_NEWNET |
CLONE_NEWUTS,
CLONE_NEWUTS | SIGCHLD,
(void *)&arg);
if (pasta_child_pid == -1) {