svn commit: r183898 - in stable/7/sys: . kern

Robert Watson rwatson at FreeBSD.org
Tue Oct 14 22:48:38 UTC 2008


Author: rwatson
Date: Tue Oct 14 22:48:38 2008
New Revision: 183898
URL: http://svn.freebsd.org/changeset/base/183898

Log:
  Merge r183675 from head to stable/7:
  
    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
  
  Approved by:	re (kib)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/kern/uipc_socket.c

Modified: stable/7/sys/kern/uipc_socket.c
==============================================================================
--- stable/7/sys/kern/uipc_socket.c	Tue Oct 14 22:11:18 2008	(r183897)
+++ stable/7/sys/kern/uipc_socket.c	Tue Oct 14 22:48:38 2008	(r183898)
@@ -1900,7 +1900,8 @@ soreceive_dgram(struct socket *so, struc
 			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);
 		}


More information about the svn-src-stable-7 mailing list