aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <goliath@infraroot.at>2019-03-20 15:27:13 +0100
committerDavid Oberhollenzer <goliath@infraroot.at>2019-03-20 15:44:14 +0100
commite21840cfced42425b9e742fbd199a19369d0b614 (patch)
tree9dfe35ebf8624d95d0b144c3d28ea4fa262dd379
parent390175c4062b414520129f9bbdf6a15cdb47d210 (diff)
initd: don't start runsvc for services without exec block
First in rdsvc, tag the services that *do* have exec lines, even if we don't read them. Second, if a service does not have that flag set, don't try to execute it. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
-rw-r--r--initd/supervisor.c10
-rw-r--r--lib/include/service.h2
-rw-r--r--lib/init/rdsvc.c2
3 files changed, 13 insertions, 1 deletions
diff --git a/initd/supervisor.c b/initd/supervisor.c
index cd38469..451ad93 100644
--- a/initd/supervisor.c
+++ b/initd/supervisor.c
@@ -156,6 +156,14 @@ bool supervisor_process_queues(void)
svc = queue;
queue = queue->next;
+ if (!(svc->flags & SVC_FLAG_HAS_EXEC)) {
+ print_status(svc->desc, STATUS_OK, false);
+ svc->status = EXIT_SUCCESS;
+ svc->next = completed;
+ completed = svc;
+ goto out;
+ }
+
if (start_service(svc) != 0)
return true;
@@ -171,7 +179,7 @@ bool supervisor_process_queues(void)
singleshot += 1;
break;
}
-
+out:
if (singleshot == 0 && queue == NULL && !waiting)
target_completed(target);
return true;
diff --git a/lib/include/service.h b/lib/include/service.h
index e46cd0e..85b82c5 100644
--- a/lib/include/service.h
+++ b/lib/include/service.h
@@ -41,6 +41,8 @@ enum {
enum {
/* truncate stdout */
SVC_FLAG_TRUNCATE_OUT = 0x01,
+
+ SVC_FLAG_HAS_EXEC = 0x10,
};
typedef struct service_t {
diff --git a/lib/init/rdsvc.c b/lib/init/rdsvc.c
index b86a27b..7ce68e3 100644
--- a/lib/init/rdsvc.c
+++ b/lib/init/rdsvc.c
@@ -81,6 +81,8 @@ static int svc_exec(void *user, char *arg, rdline_t *rd, int flags)
service_t *svc = user;
exec_t *e, *end;
+ svc->flags |= SVC_FLAG_HAS_EXEC;
+
if (flags & RDSVC_NO_EXEC)
return 0;