summaryrefslogtreecommitdiffstats
path: root/src/nspawn/nspawn.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-06-22 22:24:04 +0200
committerLennart Poettering <lennart@poettering.net>2023-06-23 10:05:16 +0200
commit8c3fe1b5b59ebfd6e462245f2ab82097b4f7494d (patch)
tree4f9dab8ca39791f570f38df3a242b6e03b45f6d6 /src/nspawn/nspawn.c
parentdocs: document threading situation in coding style (diff)
downloadsystemd-8c3fe1b5b59ebfd6e462245f2ab82097b4f7494d.tar.xz
systemd-8c3fe1b5b59ebfd6e462245f2ab82097b4f7494d.zip
process-util: add simple wrapper around PR_SET_CHILD_SUBREAPER
Let's a simple helper that knows how to deal with PID == 1.
Diffstat (limited to 'src/nspawn/nspawn.c')
-rw-r--r--src/nspawn/nspawn.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 97a2c386e6..4fdb5e9fd7 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -5826,8 +5826,9 @@ static int run(int argc, char *argv[]) {
assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGCHLD, SIGWINCH, SIGTERM, SIGINT, SIGRTMIN+18, -1) >= 0);
- if (prctl(PR_SET_CHILD_SUBREAPER, 1, 0, 0, 0) < 0) {
- r = log_error_errno(errno, "Failed to become subreaper: %m");
+ r = make_reaper_process(true);
+ if (r < 0) {
+ log_error_errno(r, "Failed to become subreaper: %m");
goto finish;
}