In soreceive_dgram, when a 0-length buffer is passed into recv(2) and

no data is ready, return 0 rather than blocking or returning EAGAIN.
This is consistent with the behavior of soreceive_generic (soreceive)
in earlier versions of FreeBSD, and restores this behavior for UDP.

Discussed with:	jhb, sam
MFC after:	3 days
This commit is contained in:
rwatson 2008-10-07 20:57:55 +00:00
parent 964dbca2f3
commit 72d39e41ec

View File

@ -1898,7 +1898,8 @@ soreceive_dgram(struct socket *so, struct sockaddr **psa, struct uio *uio,
SOCKBUF_UNLOCK(&so->so_rcv);
return (error);
}
if (so->so_rcv.sb_state & SBS_CANTRCVMORE) {
if (so->so_rcv.sb_state & SBS_CANTRCVMORE ||
uio->uio_resid == 0) {
SOCKBUF_UNLOCK(&so->so_rcv);
return (0);
}