diff options
author | paul <paul> | 2004-11-08 15:43:21 +0000 |
---|---|---|
committer | paul <paul> | 2004-11-08 15:43:21 +0000 |
commit | 178008b5ec24c1077046e3b7f4ecc7d1c003dea8 (patch) | |
tree | 1f6777aa844e919df03870310c271417aad889e5 /lib/buffer.c | |
parent | ab1b5e29280095604dbb195033ac75f480c66f8e (diff) | |
download | quagga-178008b5ec24c1077046e3b7f4ecc7d1c003dea8.tar.bz2 quagga-178008b5ec24c1077046e3b7f4ecc7d1c003dea8.tar.xz |
2004-11-07 Paul Jakma <paul@dishone.st>
* buffer.c: Add missing include of log.h.
(buffer_flush_available) written is compared against
mostly against unsigned types, only for the writev do we need
signed compare, so declare it as size_t and cast it to ssize_t
just for the error compare when we've called writev.
* buffer.h: Add comment that buffer data sizes really should be
size_t.
Diffstat (limited to 'lib/buffer.c')
-rw-r--r-- | lib/buffer.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/buffer.c b/lib/buffer.c index 9d931a9b..3701e121 100644 --- a/lib/buffer.c +++ b/lib/buffer.c @@ -24,6 +24,7 @@ #include "memory.h" #include "buffer.h" +#include "log.h" #include <stddef.h> /* Make buffer data. */ @@ -580,9 +581,9 @@ in one shot. */ struct buffer_data *d; struct buffer_data *next; - ssize_t written; + size_t written; struct iovec iov[MAX_CHUNKS]; - int iovcnt = 0; + size_t iovcnt = 0; size_t nbyte = 0; for (d = b->head; d && (iovcnt < MAX_CHUNKS) && (nbyte < MAX_FLUSH); @@ -592,7 +593,8 @@ in one shot. */ nbyte += (iov[iovcnt].iov_len = d->cp-d->sp); } - if ((written = writev(fd,iov,iovcnt)) < 0) + /* only place where written should be sign compared */ + if ((ssize_t)(written = writev(fd,iov,iovcnt)) < 0) { if ((errno != EAGAIN) && (errno != EINTR)) zlog_warn("buffer_flush_available write error on fd %d: %s", |