From: Zbigniew Jędrzejewski-Szmek Date: Fri, 11 Oct 2019 08:53:54 +0000 (+0200) Subject: core/service: use common implementation of unit_load_fragment_and_dropin() X-Git-Tag: v244-rc1~197^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0cfed4c59ebb1443c21d494ed028cf810c03488;p=thirdparty%2Fsystemd.git core/service: use common implementation of unit_load_fragment_and_dropin() There is a slight functional change when load_state == UNIT_MERGED. Before, we would not call unit_load_dropin(), but now we do. I'm not sure if this causes an actual difference in behaviour, but since all other unit types do this, I think it's better to do the same thing here too. --- diff --git a/src/core/service.c b/src/core/service.c index ada25e634a0..a9143bcc4e7 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -548,9 +548,7 @@ static int service_arm_timer(Service *s, usec_t usec) { static int service_verify(Service *s) { assert(s); - - if (UNIT(s)->load_state != UNIT_LOADED) - return 0; + assert(UNIT(s)->load_state == UNIT_LOADED); if (!s->exec_command[SERVICE_EXEC_START] && !s->exec_command[SERVICE_EXEC_STOP] && UNIT(s)->success_action == EMERGENCY_ACTION_NONE) { @@ -760,32 +758,17 @@ static int service_load(Unit *u) { Service *s = SERVICE(u); int r; - assert(s); - - /* Load a .service file */ - r = unit_load_fragment(u); + r = unit_load_fragment_and_dropin(u, true); if (r < 0) return r; - /* Still nothing found? Then let's give up */ - if (u->load_state == UNIT_STUB) - return -ENOENT; + if (u->load_state != UNIT_LOADED) + return 0; /* This is a new unit? Then let's add in some extras */ - if (u->load_state == UNIT_LOADED) { - - /* We were able to load something, then let's add in - * the dropin directories. */ - r = unit_load_dropin(u); - if (r < 0) - return r; - - /* This is a new unit? Then let's add in some - * extras */ - r = service_add_extras(s); - if (r < 0) - return r; - } + r = service_add_extras(s); + if (r < 0) + return r; return service_verify(s); }