summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/syslog.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2003-01-02 19:39:07 +0000
committermillert <millert@openbsd.org>2003-01-02 19:39:07 +0000
commit5f4325a98089cf6f1fc0977641527f7c91853f59 (patch)
tree6ad3cb313318f1ccd4fbc55ded644bab84e73a4b /lib/libc/gen/syslog.c
parentsync (diff)
downloadwireguard-openbsd-5f4325a98089cf6f1fc0977641527f7c91853f59.tar.xz
wireguard-openbsd-5f4325a98089cf6f1fc0977641527f7c91853f59.zip
Handle things like "%%m" correctly; closes PR 3057
OK miod@
Diffstat (limited to 'lib/libc/gen/syslog.c')
-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;