summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-01-02 19:39:08 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-01-02 19:39:08 +0000
commit4e1f18958aa4fb424e5d1f769528e2025ac10e79 (patch)
treeed7b003d9c47e5c6cb85634d92dc484774d05961
parent361e73cdf78ced1064f0d0b04c412e3fb50ba50e (diff)
Handle things like "%%m" correctly; closes PR 3057
OK miod@
-rw-r--r--lib/libc/gen/syslog.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c
index 802d00677a6..7cfed0f076f 100644
--- a/lib/libc/gen/syslog.c
+++ b/lib/libc/gen/syslog.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: syslog.c,v 1.20 2002/11/24 01:49:37 cloder Exp $";
+static char rcsid[] = "$OpenBSD: syslog.c,v 1.21 2003/01/02 19:39:07 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -236,6 +236,11 @@ vsyslog_r(pri, data, fmt, ap)
prlen = fmt_left - 1;
t += prlen;
fmt_left -= prlen;
+ } else if (ch == '%' && fmt[1] == '%' && fmt_left > 2) {
+ *t++ = '%';
+ *t++ = '%';
+ fmt++;
+ fmt_left -= 2;
} else {
if (fmt_left > 1) {
*t++ = ch;