summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/fhandler.h1
-rw-r--r--winsup/cygwin/fhandler_socket_unix.cc11
2 files changed, 10 insertions, 2 deletions
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 5ceedd9ff..2a3b3662d 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -900,6 +900,7 @@ class fhandler_socket_unix : public fhandler_socket
: set_peer_sun_path (NULL, 0); }
void set_cred ();
void fixup_after_fork (HANDLE parent);
+ void fixup_after_exec ();
void set_close_on_exec (bool val);
public:
diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc
index 9ac9b2452..6e7d6f147 100644
--- a/winsup/cygwin/fhandler_socket_unix.cc
+++ b/winsup/cygwin/fhandler_socket_unix.cc
@@ -982,6 +982,8 @@ fhandler_socket_unix::set_cred ()
peer_cred.gid = (gid_t) -1;
}
+/* ========================== public methods ========================= */
+
void
fhandler_socket_unix::fixup_after_fork (HANDLE parent)
{
@@ -997,6 +999,13 @@ fhandler_socket_unix::fixup_after_fork (HANDLE parent)
}
void
+fhandler_socket_unix::fixup_after_exec ()
+{
+ if (!close_on_exec ())
+ fixup_after_fork (NULL);
+}
+
+void
fhandler_socket_unix::set_close_on_exec (bool val)
{
fhandler_base::set_close_on_exec (val);
@@ -1004,8 +1013,6 @@ fhandler_socket_unix::set_close_on_exec (bool val)
set_no_inheritance (backing_file_handle, val);
}
-/* ========================== public methods ========================= */
-
fhandler_socket_unix::fhandler_socket_unix ()
{
set_cred ();