* net.cc (cygwin_recvfrom): Don't shortcircuit if len == 0. Add comment

to explain why.
	(cygwin_recv): Ditto.
	(cygwin_recvmsg): Ditto.
This commit is contained in:
Corinna Vinschen 2012-05-21 14:56:02 +00:00
parent ece05938f2
commit 6cb222edce
2 changed files with 22 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2012-05-21 Corinna Vinschen <corinna@vinschen.de>
* net.cc (cygwin_recvfrom): Don't shortcircuit if len == 0. Add comment
to explain why.
(cygwin_recv): Ditto.
(cygwin_recvmsg): Ditto.
2012-05-21 Corinna Vinschen <corinna@vinschen.de>
* fhandler_disk_file.cc (path_conv::isgood_inode): Rearrange, take

View File

@ -712,7 +712,11 @@ cygwin_recvfrom (int fd, void *buf, size_t len, int flags,
myfault efault;
if (efault.faulted (EFAULT) || !fh)
res = -1;
else if ((res = len) != 0)
else
/* Originally we shortcircuited here if res == 0.
Allow 0 bytes buffer. This is valid in POSIX and handled in
fhandler_socket::recv_internal. If we shortcircuit, we fail
to deliver valid error conditions and peer address. */
res = fh->recvfrom (buf, len, flags, from, fromlen);
syscall_printf ("%R = recvfrom(%d, %p, %d, %x, %p, %p)",
@ -1465,7 +1469,11 @@ cygwin_recv (int fd, void *buf, size_t len, int flags)
myfault efault;
if (efault.faulted (EFAULT) || !fh)
res = -1;
else if ((res = len) != 0)
else
/* Originally we shortcircuited here if res == 0.
Allow 0 bytes buffer. This is valid in POSIX and handled in
fhandler_socket::recv_internal. If we shortcircuit, we fail
to deliver valid error conditions. */
res = fh->recvfrom (buf, len, flags, NULL, NULL);
syscall_printf ("%R = recv(%d, %p, %d, %x)", res, fd, buf, len, flags);
@ -2865,7 +2873,11 @@ cygwin_recvmsg (int fd, struct msghdr *msg, int flags)
else
{
res = check_iovec_for_read (msg->msg_iov, msg->msg_iovlen);
if (res > 0)
/* Originally we shortcircuited here if res == 0.
Allow 0 bytes buffer. This is valid in POSIX and handled in
fhandler_socket::recv_internal. If we shortcircuit, we fail
to deliver valid error conditions and peer address. */
if (res >= 0)
res = fh->recvmsg (msg, flags);
}