From 2ae008bceed776c713374f3f198b0906b7400424 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Thu, 12 Dec 2019 14:12:39 +0100 Subject: [PATCH] ntp: print name of replaced source in log message --- ntp_sources.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ntp_sources.c b/ntp_sources.c index fa21654..0f9eaba 100644 --- a/ntp_sources.c +++ b/ntp_sources.c @@ -329,6 +329,7 @@ replace_source(NTP_Remote_Address *old_addr, NTP_Remote_Address *new_addr) int slot1, slot2, found; SourceRecord *record; struct SourcePool *pool; + char *name; find_slot(old_addr, &slot1, &found); if (!found) @@ -351,12 +352,13 @@ replace_source(NTP_Remote_Address *old_addr, NTP_Remote_Address *new_addr) } } + name = record->name; + /* The hash table must be rebuilt for the new address */ rehash_records(); - LOG(LOGS_INFO, "Source %s replaced with %s", - UTI_IPToString(&old_addr->ip_addr), - UTI_IPToString(&new_addr->ip_addr)); + LOG(LOGS_INFO, "Source %s replaced with %s (%s)", UTI_IPToString(&old_addr->ip_addr), + UTI_IPToString(&new_addr->ip_addr), name ? name : ""); return NSR_Success; }