]> err.no Git - util-linux/commitdiff
fix logger.c the rest of the way
authorLaMont Jones <lamont@mmjgroup.com>
Sun, 29 Jul 2007 04:42:00 +0000 (22:42 -0600)
committerLaMont Jones <lamont@mmjgroup.com>
Sun, 29 Jul 2007 04:42:00 +0000 (22:42 -0600)
misc-utils/logger.c

index ae23e3475576ad24fb82fbd57d44109d5dcb08d7..40db42b5bd15da1b2278289bb3f2a21df1dbaf09 100644 (file)
@@ -91,6 +91,7 @@ mysyslog(int fd, int logflags, int pri, char *tag, char *msg) {
        if (fd > -1) {
                if (logflags & LOG_PID)
                        snprintf (pid, sizeof(pid)-1, "[%d]", getpid());
+                      pid[sizeof(pid)-1]=0;
               else
                       pid[0] = 0;
                if (tag)
@@ -105,6 +106,7 @@ mysyslog(int fd, int logflags, int pri, char *tag, char *msg) {
 
                snprintf(buf, sizeof(buf)-1, "<%d>%.15s %.200s%s: %.400s",
                        pri, tp, cp, pid, msg);
+              buf[sizeof(buf)-1]=0;
 
                if (write(fd, buf, strlen(buf)+1) < 0)
                        return; /* error */