timedate: treat 'activating' or 'inactivating' NTP client status as 'active'

When `timedatectl set-time` is called, NTP client may be in
'activating' or something. For safety, let's treat such states as
'active'.

This also changes all unit file status except for 'masked' or 'disabled'
are treated as 'enabled'.
This commit is contained in:
Yu Watanabe
2019-01-15 14:44:32 +09:00
parent 1c8e48f506
commit 84a87726ee
+2 -2
View File
@@ -160,7 +160,7 @@ static int context_ntp_service_is_active(Context *c) {
/* Call context_update_ntp_status() to update UnitStatusInfo before calling this. */
LIST_FOREACH(units, info, c->units)
count += streq_ptr(info->active_state, "active");
count += !STRPTR_IN_SET(info->active_state, "inactive", "failed");
return count;
}
@@ -174,7 +174,7 @@ static int context_ntp_service_is_enabled(Context *c) {
/* Call context_update_ntp_status() to update UnitStatusInfo before calling this. */
LIST_FOREACH(units, info, c->units)
count += STRPTR_IN_SET(info->unit_file_state, "enabled", "enabled-runtime");
count += !STRPTR_IN_SET(info->unit_file_state, "masked", "masked-runtime", "disabled", "bad");
return count;
}