1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-26 03:22:00 +03:00

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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-10-11 10:53:54 +02:00
parent c362077087
commit e0cfed4c59

View File

@ -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);
}