From 04dfc5b81fd8d59a8ac6d27f23a7fb530a1eb515 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Wed, 8 Feb 2023 16:54:40 +0100 Subject: 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 Signed-off-by: Stefano Brivio --- pasta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pasta.c b/pasta.c index 9169913..d5f90e8 100644 --- a/pasta.c +++ b/pasta.c @@ -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) { -- cgit v1.2.3