summaryrefslogtreecommitdiff
path: root/lib/libc/gen
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2001-10-31 14:24:12 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2001-10-31 14:24:12 +0000
commiteac029ca01977e16a7ef8ec94b4802ed96764b8d (patch)
tree3b344f79095817ca2fee97de6dd2c54d0eb82b6f /lib/libc/gen
parent50531253e086c3627b7029bda3971e1998635958 (diff)
Set default facility is noone is specified at syslog(3) time; millert@ jj@ ok.
Diffstat (limited to 'lib/libc/gen')
-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