diff options
author | Kurt Miller <kurt@cvs.openbsd.org> | 2006-10-18 14:43:46 +0000 |
---|---|---|
committer | Kurt Miller <kurt@cvs.openbsd.org> | 2006-10-18 14:43:46 +0000 |
commit | a4f2385f8f621062881ed408d5a19955729fdaec (patch) | |
tree | 9625c03cb15fa928cd002e542aaa94b6d7fcc036 /sys | |
parent | bfde9a5e08bbbd7d384adb3bfb70adeaa47659ed (diff) |
Return ECONNABORTED when a non-blocking socket has been shutdown() for
receives. Previously a non-blocking socket would mask this error by
returning EWOULDBLOCK and mislead applications to think accept() may
eventually succeed. Corrects a pthreads deadlock reported by Tero Koskinen
<tero.koskinen at iki.fi> okay kettenis@, theo@, markus@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/uipc_syscalls.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 33255ad4844..214ac7b7461 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_syscalls.c,v 1.63 2006/03/26 17:47:10 mickey Exp $ */ +/* $OpenBSD: uipc_syscalls.c,v 1.64 2006/10/18 14:43:45 kurt Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */ /* @@ -165,7 +165,10 @@ sys_accept(struct proc *p, void *v, register_t *retval) goto bad; } if ((head->so_state & SS_NBIO) && head->so_qlen == 0) { - error = EWOULDBLOCK; + if (head->so_state & SS_CANTRCVMORE) + error = ECONNABORTED; + else + error = EWOULDBLOCK; goto bad; } while (head->so_qlen == 0 && head->so_error == 0) { |