]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sources: drop unreachable log message
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 21 Nov 2023 10:25:10 +0000 (11:25 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 21 Nov 2023 11:38:41 +0000 (12:38 +0100)
With forced reselection during source removal selected_source_index
can only be INVALID_SOURCE if there are no sources. The "Can't
synchronise: no sources" message couldn't be logged even before that as
SRC_ReselectSource() resets the index before calling SRC_SelectSource().

Replace the message with an assertion.

sources.c

index 4bfc1a1c19123c53d63e3bd1af8acb152da3f516..8f6caa0a96b05f4e63eee14e41440e1c3b1f55df 100644 (file)
--- a/sources.c
+++ b/sources.c
@@ -854,11 +854,9 @@ SRC_SelectSource(SRC_Instance updated_inst)
   }
 
   if (n_sources == 0) {
-    /* In this case, we clearly cannot synchronise to anything */
-    if (selected_source_index != INVALID_SOURCE) {
-      log_selection_message(LOGS_INFO, "Can't synchronise: no sources", NULL);
-      selected_source_index = INVALID_SOURCE;
-    }
+    /* Removed sources are unselected before actual removal */
+    if (selected_source_index != INVALID_SOURCE)
+      assert(0);
     return;
   }