fhandler_socket::dup

Pierre A. Humblet Pierre.Humblet@ieee.org
Tue Mar 11 01:08:00 GMT 2003


Corinna,

Here is a patch to have fhandler_socket::dup return success
or failure (related to the problem seen by Jason Tishler).

Pierre

2003-03-11  Pierre Humblet  <pierre.humblet@ieee.org>

	* fhandler_socket.cc (fhandler_socket::fixup_after_fork):
	Set io_handle to INVALID_SOCKET in case of failure.
	(fhandler_socket::dup): Return 0 iff the io_handle is valid.


Index: fhandler_socket.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/fhandler_socket.cc,v
retrieving revision 1.86
diff -u -p -r1.86 fhandler_socket.cc
--- fhandler_socket.cc  9 Mar 2003 20:31:07 -0000       1.86
+++ fhandler_socket.cc  11 Mar 2003 00:21:18 -0000
@@ -344,6 +344,7 @@ fhandler_socket::fixup_after_fork (HANDL
                                   prot_info_ptr, 0, 0)) == INVALID_SOCKET)
     {
       debug_printf ("WSASocket error");
+      set_io_handle ((HANDLE) new_sock);
       set_winsock_errno ();
     }
   else if (!new_sock && !winsock2_active)
@@ -389,7 +390,7 @@ fhandler_socket::dup (fhandler_base *chi
   if (winsock2_active)
     {
       fhs->fixup_after_fork (hMainProc);
-      return 0;
+      return get_io_handle () == (HANDLE) INVALID_SOCKET;
     }
   return fhandler_base::dup (child);
 }



More information about the Cygwin-patches mailing list