chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
dd8f71e
)
service: add basic validation hooks
author
Lennart Poettering
<lennart@poettering.net>
Tue, 13 Apr 2010 02:00:03 +0000
(
04:00
+0200)
committer
Lennart Poettering
<lennart@poettering.net>
Tue, 13 Apr 2010 02:00:03 +0000
(
04:00
+0200)
service.c
patch
|
blob
|
history
diff --git
a/service.c
b/service.c
index a7af4fdeea175ad35bfc96310020153e964fabda..21e8436661523a8605d78fa4727e1ff29c01d6f6 100644
(file)
--- 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);
}
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);
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 r;
}
- return
0
;
+ return
service_verify(s)
;
}
static void service_dump(Unit *u, FILE *f, const char *prefix) {
}
static void service_dump(Unit *u, FILE *f, const char *prefix) {