summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_prf.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2000-03-13 04:05:13 +0000
committermillert <millert@openbsd.org>2000-03-13 04:05:13 +0000
commit76c0ce9a3599191b646311069f2c7e11a3be5098 (patch)
tree7806640171de5c584d84d14e44a5c36bdaecc677 /sys/kern/subr_prf.c
parentavoid unused variable by #ifdef (diff)
downloadwireguard-openbsd-76c0ce9a3599191b646311069f2c7e11a3be5098.tar.xz
wireguard-openbsd-76c0ce9a3599191b646311069f2c7e11a3be5098.zip
Get rid of leading NULs in /kern/msgbuf. If the msgbuf modified in between
reads at just the right time is is possible to get duplicate output but in practice this is extremely rare. Joint effort with Theo.
Diffstat (limited to 'sys/kern/subr_prf.c')
-rw-r--r--sys/kern/subr_prf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c
index 5ab131ddc8d..5bd4b69546d 100644
--- a/sys/kern/subr_prf.c
+++ b/sys/kern/subr_prf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_prf.c,v 1.28 2000/03/02 10:50:29 art Exp $ */
+/* $OpenBSD: subr_prf.c,v 1.29 2000/03/13 04:05:15 millert Exp $ */
/* $NetBSD: subr_prf.c,v 1.45 1997/10/24 18:14:25 chuck Exp $ */
/*-
@@ -335,6 +335,7 @@ putchar(c, flags, tp)
/* Nothing we can do */
}
mbp->msg_bufc[mbp->msg_bufx++] = c;
+ mbp->msg_bufl = min(mbp->msg_bufl+1, mbp->msg_bufs);
if (mbp->msg_bufx < 0 || mbp->msg_bufx >= mbp->msg_bufs)
mbp->msg_bufx = 0;
/* If the buffer is full, keep the most recent data. */