From: Lennart Poettering Date: Wed, 16 Sep 2020 20:11:48 +0000 (+0200) Subject: nspawn: check return of setsid() X-Git-Tag: v247-rc1~202^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=efe426624046089b74b70708e61f304f3cd414a7;p=thirdparty%2Fsystemd.git nspawn: check return of setsid() Let's verify that everything works the way we expect it to work, hence check setsid() return code. --- diff --git a/src/nspawn/nspawn-stub-pid1.c b/src/nspawn/nspawn-stub-pid1.c index d86dd23185d..f785a3b2483 100644 --- a/src/nspawn/nspawn-stub-pid1.c +++ b/src/nspawn/nspawn-stub-pid1.c @@ -66,7 +66,10 @@ int stub_pid1(sd_id128_t uuid) { if (pid == 0) { /* Return in the child */ assert_se(sigprocmask(SIG_SETMASK, &oldmask, NULL) >= 0); - setsid(); + + if (setsid() < 0) + return log_error_errno(errno, "Failed to become session leader in payload process: %m"); + return 0; }