svn commit: r208601 - head/sys/kern

Robert Watson rwatson at FreeBSD.org
Thu May 27 15:27:31 UTC 2010


Author: rwatson
Date: Thu May 27 15:27:31 2010
New Revision: 208601
URL: http://svn.freebsd.org/changeset/base/208601

Log:
  When close() is called on a connected socket pair, SO_ISCONNECTED might be
  set but be cleared before the call to sodisconnect().  In this case,
  ENOTCONN is returned: suppress this error rather than returning it to
  userspace so that close() doesn't report an error improperly.
  
  PR:		kern/144061
  Reported by:	Matt Reimer <mreimer at vpop.net>,
  		Nikolay Denev <ndenev at gmail.com>,
  		Mikolaj Golub <to.my.trociny at gmail.com>
  MFC after:	3 days

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c	Thu May 27 15:17:06 2010	(r208600)
+++ head/sys/kern/uipc_socket.c	Thu May 27 15:27:31 2010	(r208601)
@@ -665,8 +665,11 @@ soclose(struct socket *so)
 	if (so->so_state & SS_ISCONNECTED) {
 		if ((so->so_state & SS_ISDISCONNECTING) == 0) {
 			error = sodisconnect(so);
-			if (error)
+			if (error) {
+				if (error == ENOTCONN)
+					error = 0;
 				goto drop;
+			}
 		}
 		if (so->so_options & SO_LINGER) {
 			if ((so->so_state & SS_ISDISCONNECTING) &&


More information about the svn-src-all mailing list