Subject: kern/5486: poll(2)ing a remotely closed socket for POLLIN does not POLLHUP
To: None <gnats-bugs@gnats.netbsd.org>
From: Ignatios Souvatzis <ignatios@cosinus.cs.uni-bonn.de>
List: netbsd-bugs
Date: 05/24/1998 16:35:24
>Number:         5486
>Category:       kern
>Synopsis:       poll(2)ing a remotely closed socket for POLLIN does not POLLHUP
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 24 07:50:01 1998
>Last-Modified:
>Originator:     Ignatios Souvatzis
>Organization:
computer science department, university of Bonn, Germany
>Release:        some recent 1.3E
>Environment:
	
System: NetBSD cosinus.cs.uni-bonn.de 1.3E NetBSD 1.3E (COSINUS) #7: Thu Apr 2 15:20:32 CEST 1998 ignatios@cosinus.cs.uni-bonn.de:/usr/local/obj/kernel/COSINUS i386


>Description:
	poll(2)ing a (TCP/IP) socket for POLLIN that has been closed, or is
closed during the poll, does not return POLLHUP as advertized. (To be precise:
no other revent flag is set.) Instead a POLLIN event is returned, and a read
on the descriptor returns 0 bytes. 

>How-To-Repeat:
	Test program available on request.
>Fix:
	Check reads for a zero length.
	However, I'm not sure this is distinguishable from other types of
	reveive events, e.g., when the socket has been set to SO_RCVTIMEO.

>Audit-Trail:
>Unformatted: