aboutsummaryrefslogtreecommitdiff
path: root/lib/init
diff options
context:
space:
mode:
authorDavid Oberhollenzer <goliath@infraroot.at>2020-05-08 02:44:33 +0200
committerDavid Oberhollenzer <goliath@infraroot.at>2020-05-08 02:51:20 +0200
commitf6ef5b8dd3f1b8d6af104304a9988ff1f8edd182 (patch)
treebf29526bf2c57870d79546ca2823044f9e927844 /lib/init
parent62133a68b7a1aecf65765f7137ef8d6e0eed913e (diff)
Implement a "subreaper" service flag
For particularly hostile daemons. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
Diffstat (limited to 'lib/init')
-rw-r--r--lib/init/rdsvc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/init/rdsvc.c b/lib/init/rdsvc.c
index 09ed156..c461d98 100644
--- a/lib/init/rdsvc.c
+++ b/lib/init/rdsvc.c
@@ -204,6 +204,22 @@ static int svc_target(void *user, char *arg, rdline_t *rd)
return 0;
}
+static int svc_subreaper(void *user, char *arg, rdline_t *rd)
+{
+ service_t *svc = user;
+
+ if (try_unescape(arg, rd))
+ return -1;
+
+ if (strcmp(arg, "yes") == 0 || strcmp(arg, "on") == 0 ||
+ strcmp(arg, "true") == 0) {
+ svc->flags |= SVC_FLAG_SUB_REAPER;
+ } else {
+ svc->flags &= ~SVC_FLAG_SUB_REAPER;
+ }
+ return 0;
+}
+
static const cfg_param_t svc_params[] = {
{ "description", 0, svc_desc },
{ "exec", 1, svc_exec },
@@ -212,6 +228,7 @@ static const cfg_param_t svc_params[] = {
{ "tty", 0, svc_tty },
{ "before", 0, svc_before },
{ "after", 0, svc_after },
+ { "subreaper", 0, svc_subreaper },
};
service_t *rdsvc(int dirfd, const char *filename)