From 12d8ac2399b0eef40cb36d52a24d0336f97325cb Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Thu, 12 Oct 2017 08:55:42 +0200 Subject: [PATCH] service_register(): Skip bootstrap services if not in bootstrap Signed-off-by: Joachim Nilsson --- src/service.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/service.c b/src/service.c index bcc2f90f..aca5ea98 100644 --- a/src/service.c +++ b/src/service.c @@ -512,7 +512,7 @@ int service_register(int type, char *line, struct timeval *mtime, char *username #ifdef INETD_ENABLED int forking = 0; #endif - int log = 0; + int log = 0, levels = 0; char *service = NULL, *proto = NULL, *ifaces = NULL; char *cmd, *desc, *runlevels = NULL, *cond = NULL; svc_t *svc; @@ -567,6 +567,12 @@ int service_register(int type, char *line, struct timeval *mtime, char *username goto incomplete; } + levels = conf_parse_runlevels(runlevels); + if (runlevel > 0 && !ISOTHER(levels, 0)) { + _e("Skipping %s, bootstrap is completed.", cmd); + return 0; + } + /* Example: inetd ssh/tcp@eth0,eth1 or 222/tcp@eth2 */ if (service) { ifaces = strchr(service, '@'); @@ -654,7 +660,7 @@ recreate: svc->args[i][0] = 0; } - svc->runlevels = conf_parse_runlevels(runlevels); + svc->runlevels = levels; _d("Service %s runlevel 0x%2x", svc->cmd, svc->runlevels); conf_parse_cond(svc, cond);