summaryrefslogtreecommitdiff
path: root/service.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-01-28 02:44:47 +0100
committerLennart Poettering <lennart@poettering.net>2010-01-28 02:44:47 +0100
commitd46de8a1a249e179687361dcaeba27e1c586253a (patch)
tree42f790e46583f88c557ac33ea67e857654a794a4 /service.c
parent98b5b2986fa1b85fd2d2e80f867f1647b4e4e3b5 (diff)
rework config file load logic
Diffstat (limited to 'service.c')
-rw-r--r--service.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/service.c b/service.c
index 1cbfb3dceb..70299dd065 100644
--- a/service.c
+++ b/service.c
@@ -101,17 +101,18 @@ static int service_init(Unit *u) {
s->state = SERVICE_DEAD;
/* Load a .service file */
- r = unit_load_fragment(u);
-
- /* Load a classic init script as a fallback */
- if (r == -ENOENT)
- r = service_load_sysv(s);
-
- if (r < 0) {
+ if ((r = unit_load_fragment(u)) < 0) {
service_done(u);
return r;
}
+ /* Load a classic init script as a fallback, if we couldn*t find anything */
+ if (r == 0)
+ if ((r = service_load_sysv(s)) <= 0) {
+ service_done(u);
+ return r < 0 ? r : -ENOENT;
+ }
+
/* Load dropin directory data */
if ((r = unit_load_dropin(u)) < 0) {
service_done(u);