diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-06-22 22:24:04 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2023-06-23 10:05:16 +0200 |
commit | 8c3fe1b5b59ebfd6e462245f2ab82097b4f7494d (patch) | |
tree | 4f9dab8ca39791f570f38df3a242b6e03b45f6d6 /src/nspawn/nspawn.c | |
parent | docs: document threading situation in coding style (diff) | |
download | systemd-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.c | 5 |
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; } |