summaryrefslogtreecommitdiff
path: root/src/timedate
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-01-15 02:59:48 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-01-15 14:44:32 +0900
commit84a87726eec88e7b11c8aa633bca006a0c0fc435 (patch)
treeb4122d3e06be3cae9ea740cfb97bdb1e388af921 /src/timedate
parent1c8e48f50661504e6b74a0eeaa3336f54e1e4238 (diff)
downloadsystemd-84a87726eec88e7b11c8aa633bca006a0c0fc435.tar.gz
systemd-84a87726eec88e7b11c8aa633bca006a0c0fc435.tar.bz2
systemd-84a87726eec88e7b11c8aa633bca006a0c0fc435.zip
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'.
Diffstat (limited to 'src/timedate')
-rw-r--r--src/timedate/timedated.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index e16888945c..12308bed42 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -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;
}