Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libwrap instead of handling %m inline, escape it.
details: https://anonhg.NetBSD.org/src/rev/a906da95de8e
branches: trunk
changeset: 995948:a906da95de8e
user: christos <christos%NetBSD.org@localhost>
date: Fri Jan 11 13:05:57 2019 +0000
description:
instead of handling %m inline, escape it.
diffstat:
lib/libwrap/diag.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diffs (40 lines):
diff -r b132194762ba -r a906da95de8e lib/libwrap/diag.c
--- a/lib/libwrap/diag.c Fri Jan 11 08:30:19 2019 +0000
+++ b/lib/libwrap/diag.c Fri Jan 11 13:05:57 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: diag.c,v 1.13 2019/01/10 13:53:58 christos Exp $ */
+/* $NetBSD: diag.c,v 1.14 2019/01/11 13:05:57 christos Exp $ */
/*
* Routines to report various classes of problems. Each report is decorated
@@ -16,7 +16,7 @@
#if 0
static char sccsid[] = "@(#) diag.c 1.1 94/12/28 17:42:20";
#else
-__RCSID("$NetBSD: diag.c,v 1.13 2019/01/10 13:53:58 christos Exp $");
+__RCSID("$NetBSD: diag.c,v 1.14 2019/01/11 13:05:57 christos Exp $");
#endif
#endif
@@ -46,10 +46,10 @@
tcpd_diag(int severity, const char *tag, const char *fmt, va_list ap)
{
char *buf, *buf2, *ptr;
+ int oerrno = errno;
if ((ptr = strstr(fmt, "%m")) != NULL) {
- if (asprintf(&buf, "%.*s%s%s", (int)(ptr - fmt), fmt, strerror(errno),
- ptr + 2) == -1)
+ if (asprintf(&buf, "%.*s%%%s", (int)(ptr - fmt), fmt, ptr) == -1)
buf = __UNCONST(fmt);
} else {
buf = __UNCONST(fmt);
@@ -59,6 +59,8 @@
if (vasprintf(&buf2, buf, ap) == -1)
buf2 = buf;
+ errno = oerrno;
+
/* contruct the tag for the log entry */
if (tcpd_context.file)
syslog(severity, "%s: %s, line %d: %s",
Home |
Main Index |
Thread Index |
Old Index