According to the documentation, the FallbackTimeservers setting is only
supposed to be used, quote, "when there are no timeserver set by the
user or by the service". However the code unconditionally added the
FallbackTimeservers to the service's Timeservers list regardless of
other time servers being present. This commit fixes that.
---
 src/timeserver.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/timeserver.c b/src/timeserver.c
index d719d08..7e38df9 100644
--- a/src/timeserver.c
+++ b/src/timeserver.c
@@ -210,9 +210,15 @@ GSList *__connman_timeserver_get_all(struct 
connman_service *service)
 
        g_strfreev(timeservers);
 
+       if (list)
+               return g_slist_reverse(list);
+
+       /*
+        * If we still have no time servers, we will use whatever is in the
+        * "FallbackTimeservers" configuration option as a last resort.
+        */
        fallback_ts = connman_setting_get_string_list("FallbackTimeservers");
 
-       /* Lastly add the fallback servers */
        for (i = 0; fallback_ts && fallback_ts[i]; i++)
                list = __connman_timeserver_add_list(list, fallback_ts[i]);
 
-- 
2.1.0

_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to