summaryrefslogtreecommitdiff
path: root/lib/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/buffer.c')
-rw-r--r--lib/buffer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/buffer.c b/lib/buffer.c
index 03202f1253..b573981c1b 100644
--- a/lib/buffer.c
+++ b/lib/buffer.c
@@ -429,6 +429,9 @@ in one shot. */
size_t iovcnt = 0;
size_t nbyte = 0;
+ if (fd < 0)
+ return BUFFER_ERROR;
+
for (d = b->head; d && (iovcnt < MAX_CHUNKS) && (nbyte < MAX_FLUSH);
d = d->next, iovcnt++) {
iov[iovcnt].iov_base = d->data + d->sp;