]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
More cleanup of fix for Bug 1320
authorHarlan Stenn <stenn@ntp.org>
Tue, 13 Nov 2012 23:50:25 +0000 (18:50 -0500)
committerHarlan Stenn <stenn@ntp.org>
Tue, 13 Nov 2012 23:50:25 +0000 (18:50 -0500)
bk: 50a2dcc1lByJNE62F9xA2NYMoejeYw

ntpd/ntpd.c

index 6a8f78003949863291e547b26787c4760669e68b..577a4e3c9d388d8dd42dafb233e309032f93b3ec 100644 (file)
@@ -485,15 +485,19 @@ ntpdmain(
 
        {
                int i;
-               char buf[4096];
+               char buf[1024]; /* Secret knowledge of msyslog buf length */
                char *cp = buf;
 
+               /* Note that every arg has an initial space character */
+               snprintf(cp, sizeof(buf), "Command line:");
+               cp += strlen(cp);
+
                for (i = 0; i < saved_argc ; ++i) {
-                       snprintf(cp, sizeof buf - (cp - buf),
-                               "%s%s", &" "[(cp == buf)], saved_argv[i]);
+                       snprintf(cp, sizeof(buf) - (cp - buf),
+                               " %s", saved_argv[i]);
                        cp += strlen(cp);
                }
-               msyslog(LOG_NOTICE, "Command line: %s", buf);
+               msyslog(LOG_NOTICE, "%s", buf);
        }
 
        /*