summaryrefslogtreecommitdiff
path: root/service.c
diff options
context:
space:
mode:
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);