select.cc exitsock error cleanup

Christopher Faylor cgf-no-personal-reply-please@cygwin.com
Wed May 24 03:39:00 GMT 2006


On Tue, May 23, 2006 at 10:28:51PM -0400, Lev Bishop wrote:
>On 5/23/06, Christopher Faylor wrote:
>>I've checked in a variation of this patch but I've used si->exitsock
>>for consistency.
>
>I'm sure that's wrong. With your version, the next time select() is
>called, the thread-local socket will still look like a valid socket,
>even though it has been closed and can't be used. Thus, no further
>select()ing may be done on sockets from that thread.
>
>Hmm. Also, the proper error return value appears to be 0, not -1.
>
>So try this version. (I kept si->exitsock in there for good measure --
>maybe it'll help someone stepping through with a debugger one day,
>etc).
>
>2006-05-23  Lev Bishop  <lev.bishop+cygwin@gmail.com>
>
>	* select.cc (start_thread_socket): Really clean up exitsock in
>	case of error. Return correct error return value.

You're right.  Stupid mistake on my part.

I don't see any patch here but I will make the appropriate changes
to this function.

cgf



More information about the Cygwin-patches mailing list