1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

core: Unit's condition_result field is a boolean

Let's only assign boolean values to a boolean variable.

Unit's condition_result is not of type ConditionResult, slightly
confusingly. Let's hence not assign one of ConditionResult's values to
it, but simple booleans.

This effectively doesn't make a difference, since CONDITION_ERROR is
true when cast to bool. But it's still ugly to rely on that. And
confusing.
This commit is contained in:
Lennart Poettering 2021-08-27 16:49:12 +02:00 committed by Luca Boccassi
parent a3a5446b76
commit d52cc0a531

View File

@ -1727,7 +1727,7 @@ static bool unit_test_condition(Unit *u) {
r = manager_get_effective_environment(u->manager, &env);
if (r < 0) {
log_unit_error_errno(u, r, "Failed to determine effective environment: %m");
u->condition_result = CONDITION_ERROR;
u->condition_result = true;
} else
u->condition_result = condition_test_list(
u->conditions,