Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2002-06-10 15:07:44 +0400
committerCorinna Vinschen <corinna@vinschen.de>2002-06-10 15:07:44 +0400
commit3d78e129b748bf686e606a64c0f44ece110f4c48 (patch)
tree803eae0cc5a15675df199215e04a639394cf1aa6
parent43c3c4e37cdd286b3b8c85265e7cf5ff70c6437a (diff)
* fhandler.h (fhandler_socket::fixup_after_fork): Revert patch from
2002-06-04. * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Ditto. (fhandler_socket::dup): Ditto. * net.cc (fdsock): Make sockets explicitely noninheritable on NT.
-rw-r--r--winsup/cygwin/ChangeLog8
-rw-r--r--winsup/cygwin/fhandler.h2
-rw-r--r--winsup/cygwin/fhandler_socket.cc16
-rw-r--r--winsup/cygwin/net.cc6
4 files changed, 17 insertions, 15 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 2b86cf186..a4f227d89 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,11 @@
+2002-06-10 Corinna Vinschen <corinna@vinschen.de>
+
+ * fhandler.h (fhandler_socket::fixup_after_fork): Revert patch from
+ 2002-06-04.
+ * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Ditto.
+ (fhandler_socket::dup): Ditto.
+ * net.cc (fdsock): Make sockets explicitely noninheritable on NT.
+
2002-06-09 Christopher Faylor <cgf@redhat.com>
* fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Correctly
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 28f7082eb..08bb273a4 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -368,8 +368,6 @@ class fhandler_socket: public fhandler_base
struct _WSAPROTOCOL_INFOA *prot_info_ptr;
char *sun_path;
- void fixup_after_fork (bool, HANDLE);
-
public:
fhandler_socket ();
~fhandler_socket ();
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
index 945088756..3ef35687e 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -183,7 +183,7 @@ fhandler_socket::fixup_before_fork_exec (DWORD win_proc_id)
extern "C" void __stdcall load_wsock32 ();
void
-fhandler_socket::fixup_after_fork (bool dup, HANDLE parent)
+fhandler_socket::fixup_after_fork (HANDLE parent)
{
SOCKET new_sock;
@@ -207,10 +207,6 @@ fhandler_socket::fixup_after_fork (bool dup, HANDLE parent)
else
{
debug_printf ("WSASocket went fine new_sock %p, old_sock %p", new_sock, get_io_handle ());
-#if 1
- if (!dup && new_sock != (SOCKET) get_socket ())
- closesocket (get_socket ());
-#endif
set_io_handle ((HANDLE) new_sock);
}
@@ -219,17 +215,11 @@ fhandler_socket::fixup_after_fork (bool dup, HANDLE parent)
}
void
-fhandler_socket::fixup_after_fork (HANDLE parent)
-{
- fixup_after_fork (false, parent);
-}
-
-void
fhandler_socket::fixup_after_exec (HANDLE parent)
{
debug_printf ("here");
if (!get_close_on_exec ())
- fixup_after_fork (false, parent);
+ fixup_after_fork (parent);
#if 0
else if (!winsock2_active)
closesocket (get_socket ());
@@ -247,7 +237,7 @@ fhandler_socket::dup (fhandler_base *child)
fhs->fixup_before_fork_exec (GetCurrentProcessId ());
if (winsock2_active)
{
- fhs->fixup_after_fork (true, hMainProc);
+ fhs->fixup_after_fork (hMainProc);
return 0;
}
return fhandler_base::dup (child);
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index 5e1fc8f60..7c2d2b5ca 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -501,6 +501,12 @@ fdsock (int& fd, const char *name, SOCKET soc)
{
if (!winsock2_active)
soc = set_socket_inheritance (soc);
+ else if (wincap.has_set_handle_information ())
+ {
+ /* NT systems apparently set sockets to inheritable by default */
+ SetHandleInformation ((HANDLE)soc, HANDLE_FLAG_INHERIT, 0);
+ debug_printf ("reset socket inheritance since winsock2_active %d", winsock2_active);
+ }
else
debug_printf ("not setting socket inheritance since winsock2_active %d", winsock2_active);
fhandler_socket *fh = (fhandler_socket *) cygheap->fdtab.build_fhandler (fd, FH_SOCKET, name);