From: Harlan Stenn Date: Tue, 13 Nov 2012 08:57:34 +0000 (-0500) Subject: [Bug 1320] Log ntpd's initial command-line paprameters X-Git-Tag: NTP_4_2_7P321~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc4d52b61f6920f9c2d66fc6bfe0d3a9f7fd5e16;p=thirdparty%2Fntp.git [Bug 1320] Log ntpd's initial command-line paprameters bk: 50a20b7eFP4tWMFZ6jy_e_KrJ-fK0Q --- diff --git a/ChangeLog b/ChangeLog index 7198dfb12..e6c177699 100644 --- 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 * [Bug 969] Clarify ntpdate.html documentation about -u and ntpd. * [Bug 1217] libisc/ifiter_sysctl.c:internal_current(): Ignore RTM diff --git a/ntpd/ntpd.c b/ntpd/ntpd.c index e58a1dbce..e52dedd7e 100644 --- a/ntpd/ntpd.c +++ b/ntpd/ntpd.c @@ -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.