diff options
author | Stefan Kempf <stefan@cvs.openbsd.org> | 2016-01-13 17:05:26 +0000 |
---|---|---|
committer | Stefan Kempf <stefan@cvs.openbsd.org> | 2016-01-13 17:05:26 +0000 |
commit | 9a43d369da9c7adb042927bfc2031119cae9d1f0 (patch) | |
tree | 91a2b41b2ae4c2a5236d7abf2ba7c5f71acf392b | |
parent | 3bf9f9bcdd8d2d15f2c5d802803a82a6abc652d2 (diff) |
Convert to uiomove(); from Martin Natano, thanks!
ok deraadt@
-rw-r--r-- | sys/kern/subr_log.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index bfdb370df4a..27dcc512c75 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_log.c,v 1.36 2016/01/07 12:27:07 bluhm Exp $ */ +/* $OpenBSD: subr_log.c,v 1.37 2016/01/13 17:05:25 stefan Exp $ */ /* $NetBSD: subr_log.c,v 1.11 1996/03/30 22:24:44 christos Exp $ */ /* @@ -180,7 +180,7 @@ int logread(dev_t dev, struct uio *uio, int flag) { struct msgbuf *mbp = msgbufp; - long l; + size_t l; int s; int error = 0; @@ -202,13 +202,14 @@ logread(dev_t dev, struct uio *uio, int flag) logsoftc.sc_state &= ~LOG_RDWAIT; while (uio->uio_resid > 0) { - l = mbp->msg_bufx - mbp->msg_bufr; - if (l < 0) + if (mbp->msg_bufx >= mbp->msg_bufr) + l = mbp->msg_bufx - mbp->msg_bufr; + else l = mbp->msg_bufs - mbp->msg_bufr; - l = min(l, uio->uio_resid); + l = ulmin(l, uio->uio_resid); if (l == 0) break; - error = uiomovei(&mbp->msg_bufc[mbp->msg_bufr], (int)l, uio); + error = uiomove(&mbp->msg_bufc[mbp->msg_bufr], l, uio); if (error) break; mbp->msg_bufr += l; |