about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-06-20 02:13:38 -0400
committerRich Felker <dalias@aerifal.cx>2014-06-20 02:13:38 -0400
commit2e5d256984adb6864ece82fb689ddb2b20e10e4d (patch)
treeca5b887dec106232936221ecb942cf52d3776b4f /src
parent3fa2eb2aba8d6b54dec53e7ad4c37e17392b166f (diff)
downloadmusl-2e5d256984adb6864ece82fb689ddb2b20e10e4d.tar.gz
musl-2e5d256984adb6864ece82fb689ddb2b20e10e4d.tar.xz
musl-2e5d256984adb6864ece82fb689ddb2b20e10e4d.zip
fix sendmmsg emulation return value for zero-length vector
this case is not even documented, but the kernel returns 0 here and it
makes sense to be consistent.
Diffstat (limited to 'src')
-rw-r--r--src/network/sendmmsg.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/network/sendmmsg.c b/src/network/sendmmsg.c
index ff9f8618..eeae1d0a 100644
--- a/src/network/sendmmsg.c
+++ b/src/network/sendmmsg.c
@@ -12,6 +12,7 @@ int sendmmsg(int fd, struct mmsghdr *msgvec, unsigned int vlen, unsigned int fla
 	 * and the cmsg blocks cannot be modified in-place. */
 	int i;
 	if (vlen > IOV_MAX) vlen = IOV_MAX; /* This matches the kernel. */
+	if (!vlen) return 0;
 	for (i=0; i<vlen; i++) {
 		/* As an unfortunate inconsistency, the sendmmsg API uses
 		 * unsigned int for the resulting msg_len, despite sendmsg