Date: Wed, 28 Aug 2002 11:00:08 -0700 (PDT) From: Archie Cobbs <archie@packetdesign.com> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/42100: libc_r: accept(2) can't handle descriptor being closed/shutdown Message-ID: <200208281800.g7SI08cK019776@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/42100; it has been noted by GNATS. From: Archie Cobbs <archie@packetdesign.com> To: freebsd-gnats-submit@FreeBSD.org Cc: eischen@pcnet1.pcnet.com Subject: Re: bin/42100: libc_r: accept(2) can't handle descriptor being closed/shutdown Date: Wed, 28 Aug 2002 10:55:09 -0700 (PDT) The patch below fixes the problem of accept(2) returning EAGAIN on a O_NONBLOCK socket that has been shutdown(2). Now it returns ECONNABORTED, which is consistent with the normal blocking case. This makes the original test program work in the shutdown() case. However, it still fails in the close() case, and the core dump, although worked-around with this patch, remains unexplained. -Archie __________________________________________________________________________ Archie Cobbs * Packet Design * http://www.packetdesign.com Index: sys/kern/uipc_syscalls.c =================================================================== RCS file: /home/ncvs/src/sys/kern/uipc_syscalls.c,v retrieving revision 1.129 diff -u -r1.129 uipc_syscalls.c --- sys/kern/uipc_syscalls.c 15 Aug 2002 20:55:04 -0000 1.129 +++ sys/kern/uipc_syscalls.c 28 Aug 2002 17:48:28 -0000 @@ -268,14 +268,13 @@ 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, To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208281800.g7SI08cK019776>
