select.cc exitsock error cleanup

Lev Bishop lev.bishop@gmail.com
Wed May 24 02:28:00 GMT 2006


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.



More information about the Cygwin-patches mailing list