mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-12-26 21:55:44 +07:00
unit: don't recheck conditions when a unit is already starting but unit_start() is invoked
This commit is contained in:
parent
7712ea6da6
commit
a82e5507a6
16
src/unit.c
16
src/unit.c
@ -888,16 +888,20 @@ int unit_start(Unit *u) {
|
|||||||
if (u->meta.load_state != UNIT_LOADED)
|
if (u->meta.load_state != UNIT_LOADED)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* If this is already (being) started, then this will
|
/* If this is already started, then this will succeed. Note
|
||||||
* succeed. Note that this will even succeed if this unit is
|
* that this will even succeed if this unit is not startable
|
||||||
* not startable by the user. This is relied on to detect when
|
* by the user. This is relied on to detect when we need to
|
||||||
* we need to wait for units and when waiting is finished. */
|
* wait for units and when waiting is finished. */
|
||||||
state = unit_active_state(u);
|
state = unit_active_state(u);
|
||||||
if (UNIT_IS_ACTIVE_OR_RELOADING(state))
|
if (UNIT_IS_ACTIVE_OR_RELOADING(state))
|
||||||
return -EALREADY;
|
return -EALREADY;
|
||||||
|
|
||||||
/* If the conditions failed, don't do anything at all */
|
/* If the conditions failed, don't do anything at all. If we
|
||||||
if (!unit_condition_test(u)) {
|
* already are activating this call might still be useful to
|
||||||
|
* speed up activation in case there is some hold-off time,
|
||||||
|
* but we don't want to recheck the condition in that case. */
|
||||||
|
if (state != UNIT_ACTIVATING &&
|
||||||
|
!unit_condition_test(u)) {
|
||||||
log_debug("Starting of %s requested but condition failed. Ignoring.", u->meta.id);
|
log_debug("Starting of %s requested but condition failed. Ignoring.", u->meta.id);
|
||||||
return -EALREADY;
|
return -EALREADY;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user