Browse Source

make buf_write() behave like msgbuf_write(): send out only the

bytes that were filled, not the whole buffer.
ok pyr@ gilles@
OPENBSD_4_7
eric 15 years ago
parent
commit
c6ea694786
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      src/usr.sbin/ntpd/buffer.c

+ 4
- 4
src/usr.sbin/ntpd/buffer.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: buffer.c,v 1.10 2009/06/06 18:14:25 pyr Exp $ */
/* $OpenBSD: buffer.c,v 1.11 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;


Loading…
Cancel
Save