]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1320] Log ntpd's initial command-line paprameters
authorHarlan Stenn <stenn@ntp.org>
Tue, 13 Nov 2012 08:57:34 +0000 (03:57 -0500)
committerHarlan Stenn <stenn@ntp.org>
Tue, 13 Nov 2012 08:57:34 +0000 (03:57 -0500)
bk: 50a20b7eFP4tWMFZ6jy_e_KrJ-fK0Q

ChangeLog
ntpd/ntpd.c

index 7198dfb1251a61c3b426b8529441ad43178e92bc..e6c1776993d969bffe14555bceaf610345d1d0da 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+* [Bug 1320] Log ntpd's initial command-line paprameters.
 (4.2.7p320) 2012/11/12 Released by Harlan Stenn <stenn@ntp.org>
 * [Bug 969] Clarify ntpdate.html documentation about -u and ntpd.
 * [Bug 1217] libisc/ifiter_sysctl.c:internal_current(): Ignore RTM
index e58a1dbce7a0c6bf5885ba54c5be2dded0001442..e52dedd7e1898759dada0a04756437cd2b06ca5d 100644 (file)
@@ -208,6 +208,9 @@ static      RETSIGTYPE      no_debug        (int);
 # endif        /* !DEBUG */
 #endif /* !SIM && !SYS_WINNT */
 
+int    saved_argc;
+char **        saved_argv;
+
 #ifndef SIM
 int            ntpdmain                (int, char **);
 static void    set_process_priority    (void);
@@ -449,6 +452,8 @@ ntpdmain(
        else
                umask(022);
 # endif
+       saved_argc = argc;
+       saved_argv = argv;
        progname = argv[0];
        initializing = TRUE;            /* mark that we are initializing */
        parse_cmdline_opts(&argc, &argv);
@@ -478,6 +483,19 @@ ntpdmain(
        }
        msyslog(LOG_NOTICE, "%s: Starting\n", Version);
 
+       {
+               int i;
+               char buf[4096];
+               char *cp = buf;
+
+               for (i = 0; i < saved_argc ; ++i) {
+                       snprintf(cp, sizeof buf - (cp - buf),
+                               "%s%s", &" "[(cp == buf)], saved_argv[i]);
+                       cp += strlen(cp);
+               }
+               msyslog("Command line: %s", buf);
+       }
+
        /*
         * Install trap handlers to log errors and assertion failures.
         * Default handlers print to stderr which doesn't work if detached.