From owner-freebsd-bugs Wed Aug 28 11: 0:13 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3564337B400 for ; Wed, 28 Aug 2002 11:00:09 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id E453143E42 for ; Wed, 28 Aug 2002 11:00:08 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g7SI08JU019779 for ; Wed, 28 Aug 2002 11:00:08 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g7SI08cK019776; Wed, 28 Aug 2002 11:00:08 -0700 (PDT) Date: Wed, 28 Aug 2002 11:00:08 -0700 (PDT) Message-Id: <200208281800.g7SI08cK019776@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Archie Cobbs Subject: Re: bin/42100: libc_r: accept(2) can't handle descriptor being closed/shutdown Reply-To: Archie Cobbs Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/42100; it has been noted by GNATS. From: Archie Cobbs 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