]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 3637] Emit the version of ntpd in saveconfig
authorHarlan Stenn <stenn@ntp.org>
Sat, 18 Jan 2020 09:46:30 +0000 (04:46 -0500)
committerHarlan Stenn <stenn@ntp.org>
Sat, 18 Jan 2020 09:46:30 +0000 (04:46 -0500)
bk: 5e22d3f6E9erByGi6L0E15tGoOJeWQ

ntpd/Makefile.am
ntpd/ntp_config.c

index 60c5de8a1a59ecedeccb98f5372afc4b327e08e1..da2ffd04b34d049c80eac435e0ddacc0a6a0b680 100644 (file)
@@ -414,7 +414,8 @@ $(srcdir)/invoke-ntpd.texi: $(srcdir)/ntpd-opts.def $(srcdir)/ntpdbase-opts.def
 $(PROGRAMS): $(LDADD)
 
 compsave.conf: ntpd complete.conf
-       ./ntpd --configfile complete.conf --saveconfigquit $@
+       ./ntpd --configfile complete.conf --saveconfigquit $@+
+       grep -v '^#' $@+ > $@
 
 check-saveconfig: complete.conf compsave.conf
        -diff -u complete.conf compsave.conf
index 6022f9af27d8ebe1a7e2a8a2e6b8a01798666e12..58929567619978d594b8bab0ef5ff1a7f900963b 100644 (file)
@@ -29,6 +29,7 @@
 #ifdef HAVE_SYS_WAIT_H
 # include <sys/wait.h>
 #endif
+#include <time.h>
 
 #include <isc/net.h>
 #include <isc/result.h>
@@ -500,11 +501,11 @@ dump_all_config_trees(
 {
        config_tree *   cfg_ptr;
        int             return_value;
-       time_t          now = time(NULL)
+       time_t          now = time(NULL);
        struct tm       tm = *localtime(&now);
 
        fprintf(df, "#NTF:D %04d%02d%02d@%02d:%02d:%02d\n",
-               tm.tm.tm_year+1900, tm.tm_mon+1, tm.tm_day,
+               tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday,
                tm.tm_hour, tm.tm_min, tm.tm_sec);
        fprintf(df, "#NTF:V %s\n", Version);