summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/syslog.c
diff options
context:
space:
mode:
authorfgsch <fgsch@openbsd.org>2001-10-31 14:24:11 +0000
committerfgsch <fgsch@openbsd.org>2001-10-31 14:24:11 +0000
commit56b211df49252d8cccfead6ac677fce1c6548641 (patch)
treeb535919e6d68c60f3fc8774d2904386d66bc1dde /lib/libc/gen/syslog.c
parentAdd MLINK's for syslog_r and friends. (diff)
downloadwireguard-openbsd-56b211df49252d8cccfead6ac677fce1c6548641.tar.xz
wireguard-openbsd-56b211df49252d8cccfead6ac677fce1c6548641.zip
Set default facility is noone is specified at syslog(3) time; millert@ jj@ ok.
Diffstat (limited to 'lib/libc/gen/syslog.c')
-rw-r--r--lib/libc/gen/syslog.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c
index beabbcce9ba..3ad279804fa 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.12 2001/10/24 08:16:42 jjbg Exp $";
+static char rcsid[] = "$OpenBSD: syslog.c,v 1.13 2001/10/31 14:24:11 fgsch Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -192,25 +192,29 @@ vsyslog_r(pri, data, fmt, ap)
saved_errno = errno;
+ /* Set default facility if none specified. */
+ if ((pri & LOG_FACMASK) == 0)
+ pri |= data->log_fac;
+
/* If we have been called through syslog(), no need for reentrancy. */
if (data == &sdata)
(void)time(&now);
- p = tbuf;
- tbuf_left = TBUF_LEN;
-
-#define DEC() \
- do { \
- if (prlen < 0) \
- prlen = 0; \
- if (prlen >= tbuf_left) \
- prlen = tbuf_left - 1; \
- p += prlen; \
- tbuf_left -= prlen; \
- } while (0)
-
- prlen = snprintf(p, tbuf_left, "<%d>", pri);
- DEC();
+ p = tbuf;
+ tbuf_left = TBUF_LEN;
+
+#define DEC() \
+ do { \
+ if (prlen < 0) \
+ prlen = 0; \
+ if (prlen >= tbuf_left) \
+ prlen = tbuf_left - 1; \
+ p += prlen; \
+ tbuf_left -= prlen; \
+ } while (0)
+
+ prlen = snprintf(p, tbuf_left, "<%d>", pri);
+ DEC();
/*
* syslogd will expand time automagically for reentrant case, and