summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ip.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ip.cpp b/src/ip.cpp
index 66177a7..e11ec45 100644
--- a/src/ip.cpp
+++ b/src/ip.cpp
@@ -57,6 +57,13 @@ xs::fd_t xs::open_socket (int domain_, int type_, int protocol_)
errno_assert (rc != -1);
#endif
+ // On Windows, preventing sockets to be inherited by child processes is
+ // done using SetHandleInformation function.
+#if defined XS_HAVE_WINDOWS && defined HANDLE_FLAG_INHERIT
+ BOOL brc = SetHandleInformation ((HANDLE) s, HANDLE_FLAG_INHERIT, 0);
+ win_assert (brc);
+#endif
+
return s;
}