Fix available byte count returned by ioq_grow().
authorMichael Poole <mdpoole@troilus.org>
Fri, 19 Nov 2010 21:02:01 +0000 (16:02 -0500)
committerMichael Poole <mdpoole@troilus.org>
Fri, 19 Nov 2010 21:02:01 +0000 (16:02 -0500)
ioq_grow() needs to use the same -1 that ioq_put_avail() uses when
the "get" pointer is at byte 0.

src/ioset.c (ioq_grow): Reduce the reported available-byte count by 1.

src/ioset.c

index a7563d30398e90aca346eddc6b21b3e92a66a293..04cae40524e53a4f423b7d56cb117fcfcf25dccb 100644 (file)
@@ -131,7 +131,7 @@ ioq_grow(struct ioq *ioq) {
     ioq->get = 0;
     ioq->buf = new_buf;
     ioq->size = new_size;
-    return new_size - ioq->put;
+    return new_size - ioq->put - 1;
 }
 
 extern struct io_engine io_engine_kevent;