For LOG_PERROR only append a newline if necessary.
authordrepper <drepper>
Wed, 10 Nov 1999 02:38:42 +0000 (02:38 +0000)
committerdrepper <drepper>
Wed, 10 Nov 1999 02:38:42 +0000 (02:38 +0000)
misc/syslog.c

index ee832fe..9690bf1 100644 (file)
@@ -177,10 +177,14 @@ vsyslog(pri, fmt, ap)
 
                v->iov_base = buf + msgoff;
                v->iov_len = bufsize - msgoff;
-               ++v;
-               v->iov_base = (char *) "\n";
-               v->iov_len = 1;
-               (void)__writev(STDERR_FILENO, iov, 2);
+               /* Append a newline if necessary.  */
+               if (buf[bufsize - 1] != '\n')
+                 {
+                   ++v;
+                   v->iov_base = (char *) "\n";
+                   v->iov_len = 1;
+                 }
+               (void)__writev(STDERR_FILENO, iov, v - iov + 1);
        }
 
        /* Prepare for multiple users.  We have to take care: open and