diff options
author | archie <archie@FreeBSD.org> | 2002-08-28 20:56:01 +0000 |
---|---|---|
committer | archie <archie@FreeBSD.org> | 2002-08-28 20:56:01 +0000 |
commit | bf4ebb4609b4f7c170352f83aa3bf4a4fc663a5b (patch) | |
tree | a782efc3c5308dfca2b2d70d5777239600af8e92 | |
parent | 30d3848aeed001f8ddbdbb924730123fe8b91127 (diff) | |
download | FreeBSD-src-bf4ebb4609b4f7c170352f83aa3bf4a4fc663a5b.zip FreeBSD-src-bf4ebb4609b4f7c170352f83aa3bf4a4fc663a5b.tar.gz |
accept(2) on a socket that has been shutdown(2) normally returns
ECONNABORTED. Make this happen in the non-blocking case as well.
The previous behavior was to return EAGAIN, which (a) is not
consistent with the blocking case and (b) causes the application
to think the socket is still valid.
PR: bin/42100
Reviewed by: freebsd-net
MFC after: 3 days
-rw-r--r-- | sys/kern/uipc_syscalls.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 4d8d174..93e8615 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -268,16 +268,15 @@ accept1(td, uap, compat) error = EINVAL; goto done; } - if ((head->so_state & SS_NBIO) && TAILQ_EMPTY(&head->so_comp)) { - splx(s); - error = EWOULDBLOCK; - goto done; - } while (TAILQ_EMPTY(&head->so_comp) && head->so_error == 0) { if (head->so_state & SS_CANTRCVMORE) { head->so_error = ECONNABORTED; break; } + if ((head->so_state & SS_NBIO) != 0) { + head->so_error = EWOULDBLOCK; + break; + } error = tsleep(&head->so_timeo, PSOCK | PCATCH, "accept", 0); if (error) { |