summaryrefslogtreecommitdiff
path: root/iov.c
diff options
context:
space:
mode:
Diffstat (limited to 'iov.c')
-rw-r--r--iov.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/iov.c b/iov.c
index b3330610bb..60705c73ab 100644
--- a/iov.c
+++ b/iov.c
@@ -146,6 +146,13 @@ ssize_t iov_send_recv(int sockfd, struct iovec *iov, unsigned iov_cnt,
{
ssize_t ret;
unsigned si, ei; /* start and end indexes */
+ if (bytes == 0) {
+ /* Catch the do-nothing case early, as otherwise we will pass an
+ * empty iovec to sendmsg/recvmsg(), and not all implementations
+ * accept this.
+ */
+ return 0;
+ }
/* Find the start position, skipping `offset' bytes:
* first, skip all full-sized vector elements, */