diff options
author | Robert Watson <rwatson@FreeBSD.org> | 2010-05-27 15:27:31 +0000 |
---|---|---|
committer | Robert Watson <rwatson@FreeBSD.org> | 2010-05-27 15:27:31 +0000 |
commit | e35973e4b861994c1ddb955b0965e1cc510ced7c (patch) | |
tree | 87d2083f6c517412208c46706ab19af9ed191e4e /sys/kern/uipc_socket.c | |
parent | 53f563fcfc6206f7abadab770a0bf450446c62cf (diff) | |
download | src-e35973e4b861994c1ddb955b0965e1cc510ced7c.tar.gz src-e35973e4b861994c1ddb955b0965e1cc510ced7c.zip |
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
Notes
Notes:
svn path=/head/; revision=208601
Diffstat (limited to 'sys/kern/uipc_socket.c')
-rw-r--r-- | sys/kern/uipc_socket.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 569aed097603..1734960e02d6 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -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) && |