]> sourceware.org Git - newlib-cygwin.git/commitdiff
* fhandler_socket.cc (fhandler_socket::fixup_after_fork): Reset
authorCorinna Vinschen <corinna@vinschen.de>
Mon, 23 Jan 2006 15:10:57 +0000 (15:10 +0000)
committerCorinna Vinschen <corinna@vinschen.de>
Mon, 23 Jan 2006 15:10:57 +0000 (15:10 +0000)
inheritance for duplicated socket.

winsup/cygwin/ChangeLog
winsup/cygwin/fhandler_socket.cc

index 9bc68e2af2ec362ead6dc5e4e8f7c985912619f0..cae5ee6af4c804e7bbe993e70477b4b60ada580b 100644 (file)
@@ -1,3 +1,8 @@
+2006-01-23  Corinna Vinschen  <corinna@vinschen.de>
+
+       * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Reset
+       inheritance for duplicated socket.
+
 2006-01-20  Christopher Faylor  <cgf@timesys.com>
 
        * include/cygwin/version.h: Bump API minor number to 151.
index a4ca44faf61b4ba9ca2bf719b5daeb2ffe59ff37..2405471fecfbb79eb6c09152cb50b38a5e40a99c 100644 (file)
@@ -424,7 +424,16 @@ fhandler_socket::fixup_after_fork (HANDLE parent)
     }
   else
     {
-      debug_printf ("WSASocket went fine new_sock %p, old_sock %p", new_sock, get_io_handle ());
+      debug_printf ("WSASocket went fine new_sock %p, old_sock %p", new_sock, get_socket ());
+
+      /* Go figure!  Even though the original socket was not inheritable,
+        the duplicated socket is inheritable again.  This can lead to all
+        sorts of trouble, apparently.  Note that there's no way to prevent
+        this on 9x, not even by trying to reset socket inheritance using
+        DuplicateHandle and closing the original socket. */
+      if (wincap.has_set_handle_information ())
+       SetHandleInformation ((HANDLE) new_sock, HANDLE_FLAG_INHERIT, 0);
+
       set_io_handle ((HANDLE) new_sock);
     }
 }
This page took 0.033354 seconds and 5 git commands to generate.