]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
source: don't print duplicated address in selection message
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 4 May 2021 09:49:54 +0000 (11:49 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 5 May 2021 10:41:23 +0000 (12:41 +0200)
Don't print the original IP address in parentheses in the "Selected
source ..." message if it is identical to the current address. That is
expected to be the usual case for sources specified by IP address.

sources.c

index 895172e7e64869e42a4f66acbd47548efe37f341..ce0965f3aad6bbd447278923f917d4c891a1e3bc 100644 (file)
--- a/sources.c
+++ b/sources.c
@@ -589,7 +589,7 @@ log_selection_source(const char *format, SRC_Instance inst)
   name = source_to_string(inst);
   ntp_name = inst->type == SRC_NTP ? NSR_GetName(inst->ip_addr) : NULL;
 
-  if (ntp_name)
+  if (ntp_name && strcmp(name, ntp_name) != 0)
     snprintf(buf, sizeof (buf), "%s (%s)", name, ntp_name);
   else
     snprintf(buf, sizeof (buf), "%s", name);