summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2016-06-23 15:41:43 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2016-06-23 15:41:43 +0000
commitd99a169f29334a5655297c009779d7b0718ea04b (patch)
tree5dac544b6feb66f846fe9591b282f5509145c96a /sys/kern
parent1d4142c67658599ccf36e930a28d8d51d75836ce (diff)
As klog dropped message has no ifdef small kernel, sendsyslog
should not have it either. While there bring some variables in sync between both functions. OK deraadt@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/subr_log.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c
index dc0d90c1613..579a7007eef 100644
--- a/sys/kern/subr_log.c
+++ b/sys/kern/subr_log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_log.c,v 1.47 2016/06/23 13:15:21 bluhm Exp $ */
+/* $OpenBSD: subr_log.c,v 1.48 2016/06/23 15:41:42 bluhm Exp $ */
/* $NetBSD: subr_log.c,v 1.11 1996/03/30 22:24:44 christos Exp $ */
/*
@@ -377,30 +377,27 @@ sys_sendsyslog(struct proc *p, void *v, register_t *retval)
syscallarg(int) flags;
} */ *uap = v;
int error;
-#ifndef SMALL_KERNEL
static int dropped_count, orig_error;
- int len;
- char buf[64];
if (dropped_count) {
- len = snprintf(buf, sizeof(buf),
+ size_t l;
+ char buf[64];
+
+ l = snprintf(buf, sizeof(buf),
"<%d>sendsyslog: dropped %d message%s, error %d",
LOG_KERN|LOG_WARNING, dropped_count,
dropped_count == 1 ? "" : "s", orig_error);
- error = dosendsyslog(p, buf, MIN((size_t)len, sizeof(buf) - 1),
+ error = dosendsyslog(p, buf, ulmin(l, sizeof(buf) - 1),
0, UIO_SYSSPACE);
if (error == 0)
dropped_count = 0;
}
-#endif
error = dosendsyslog(p, SCARG(uap, buf), SCARG(uap, nbyte),
SCARG(uap, flags), UIO_USERSPACE);
-#ifndef SMALL_KERNEL
if (error) {
dropped_count++;
orig_error = error;
}
-#endif
return (error);
}