summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-13 04:00:03 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-13 04:00:03 +0200
commit243b1432c6c9e2b92e9fc948e119ebd6e5f4de2b (patch)
treedb70c209b8f1d0046fffa6959afc3f2a027a9a53
parentdd8f71ee9fe4408311b335726e0787a37fbf9d42 (diff)
service: add basic validation hooks
-rw-r--r--service.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/service.c b/service.c
index a7af4fdeea..21e8436661 100644
--- a/service.c
+++ b/service.c
@@ -726,6 +726,20 @@ static void service_init(Unit *u) {
RATELIMIT_INIT(s->ratelimit, 10*USEC_PER_SEC, 5);
}
+static int service_verify(Service *s) {
+ assert(s);
+
+ if (UNIT(s)->meta.load_state != UNIT_LOADED)
+ return 0;
+
+ if (!s->exec_command[SERVICE_EXEC_START]) {
+ log_error("%s lacks ExecStart setting. Refusing.", unit_id(UNIT(s)));
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
static int service_load(Unit *u) {
int r;
Service *s = SERVICE(u);
@@ -762,7 +776,7 @@ static int service_load(Unit *u) {
return r;
}
- return 0;
+ return service_verify(s);
}
static void service_dump(Unit *u, FILE *f, const char *prefix) {