summaryrefslogtreecommitdiff
path: root/usr.sbin/ospf6d
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2009-07-23 18:58:44 +0000
committerEric Faurot <eric@cvs.openbsd.org>2009-07-23 18:58:44 +0000
commit3dd2f3a3f53b9499bef4a19aa723b838ef3c6f01 (patch)
tree994e9b08b4b9f796f6f74023f195f47e22b15518 /usr.sbin/ospf6d
parent2d7a73e30bc0f15fa22d4cea93273efe89ae5c7f (diff)
make buf_write() behave like msgbuf_write(): send out only the
bytes that were filled, not the whole buffer. ok pyr@ gilles@
Diffstat (limited to 'usr.sbin/ospf6d')
-rw-r--r--usr.sbin/ospf6d/buffer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/ospf6d/buffer.c b/usr.sbin/ospf6d/buffer.c
index df39bbd9395..6717ea3da47 100644
--- a/usr.sbin/ospf6d/buffer.c
+++ b/usr.sbin/ospf6d/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.3 2009/06/06 09:02:46 eric Exp $ */
+/* $OpenBSD: buffer.c,v 1.4 2009/07/23 18:58:42 eric Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -153,7 +153,7 @@ buf_write(struct msgbuf *msgbuf)
if (i >= IOV_MAX)
break;
iov[i].iov_base = buf->buf + buf->rpos;
- iov[i].iov_len = buf->size - buf->rpos;
+ iov[i].iov_len = buf->wpos - buf->rpos;
i++;
}
@@ -173,8 +173,8 @@ buf_write(struct msgbuf *msgbuf)
for (buf = TAILQ_FIRST(&msgbuf->bufs); buf != NULL && n > 0;
buf = next) {
next = TAILQ_NEXT(buf, entry);
- if (buf->rpos + n >= buf->size) {
- n -= buf->size - buf->rpos;
+ if (buf->rpos + n >= buf->wpos) {
+ n -= buf->wpos - buf->rpos;
buf_dequeue(msgbuf, buf);
} else {
buf->rpos += n;