diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2012-04-10 18:40:44 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2012-04-11 06:07:20 +0200 |
commit | 7f7674fdffbe216f4ee5e7d46fca95e278842ab6 (patch) | |
tree | d27b452e8b7211b0b25829839eada2b88fbbaa5f | |
parent | c29605678490614d90c3850438e13c36abc6d12f (diff) |
HANDLE_FLAG_INHERIT is set to 0 on internal sockets
On Windows, HANDLE_FLAG_INHERIT is equivalent to
O_CLOEXEC on UNIX.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
-rw-r--r-- | src/ip.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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; } |