blob: 6ca16ab5a8ee6235a37a3a545300347ffb257885 [file] [log] [blame]
Lei YUe3deb2a2019-01-22 17:24:58 +08001From 84a87726eec88e7b11c8aa633bca006a0c0fc435 Mon Sep 17 00:00:00 2001
2From: Yu Watanabe <watanabe.yu+github@gmail.com>
3Date: Tue, 15 Jan 2019 02:59:48 +0900
4Subject: [PATCH 1/2] timedate: treat 'activating' or 'inactivating' NTP client
5 status as 'active'
6
7When `timedatectl set-time` is called, NTP client may be in
8'activating' or something. For safety, let's treat such states as
9'active'.
10
11This also changes all unit file status except for 'masked' or 'disabled'
12are treated as 'enabled'.
13---
14 src/timedate/timedated.c | 4 ++--
15 1 file changed, 2 insertions(+), 2 deletions(-)
16
17diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
18index e168889..12308be 100644
19--- a/src/timedate/timedated.c
20+++ b/src/timedate/timedated.c
21@@ -160,7 +160,7 @@ static int context_ntp_service_is_active(Context *c) {
22 /* Call context_update_ntp_status() to update UnitStatusInfo before calling this. */
23
24 LIST_FOREACH(units, info, c->units)
25- count += streq_ptr(info->active_state, "active");
26+ count += !STRPTR_IN_SET(info->active_state, "inactive", "failed");
27
28 return count;
29 }
30@@ -174,7 +174,7 @@ static int context_ntp_service_is_enabled(Context *c) {
31 /* Call context_update_ntp_status() to update UnitStatusInfo before calling this. */
32
33 LIST_FOREACH(units, info, c->units)
34- count += STRPTR_IN_SET(info->unit_file_state, "enabled", "enabled-runtime");
35+ count += !STRPTR_IN_SET(info->unit_file_state, "masked", "masked-runtime", "disabled", "bad");
36
37 return count;
38 }
39--
402.7.4
41