summaryrefslogtreecommitdiff
path: root/src/core/main.c
diff options
context:
space:
mode:
authorAuke Kok <auke-jan.h.kok@intel.com>2012-07-25 00:13:11 +0200
committerKay Sievers <kay@vrfy.org>2012-07-25 00:17:30 +0200
commitd4447f4d955d5bfbdec6feec8e332b8c126f474a (patch)
treeea0b4293af4cb4abc2f95d17c75300acdf043583 /src/core/main.c
parent578ac0604e6c10b267f73e114bc2215aa3f6619a (diff)
main: set PR_SET_CHILD_REAPER for MANAGER_USER
Become the reaper for all children part of the user session. Tested with several forking services.
Diffstat (limited to 'src/core/main.c')
-rw-r--r--src/core/main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/main.c b/src/core/main.c
index c7a7a87e7a..1326b94f68 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1500,6 +1500,15 @@ int main(int argc, char *argv[]) {
}
}
+ if (arg_running_as == MANAGER_USER) {
+ /* Become reaper of our children */
+ r = prctl(PR_SET_CHILD_SUBREAPER, 1);
+ if (r < 0)
+ log_error("Failed to prctl(PR_SET_CHILD_SUBREAPER): %s", strerror(-r));
+ if (r == -EINVAL)
+ log_error("Perhaps the kernel version is too old (< 3.4?)");
+ }
+
r = manager_new(arg_running_as, &m);
if (r < 0) {
log_error("Failed to allocate manager object: %s", strerror(-r));