Index: runtime/bin/socket_macos.cc |
diff --git a/runtime/bin/socket_macos.cc b/runtime/bin/socket_macos.cc |
index 5e830ff2d233c830614e6823e86805f71a2c0b4f..32db433acfc9beac929cb42432869ce9c3053bc1 100644 |
--- a/runtime/bin/socket_macos.cc |
+++ b/runtime/bin/socket_macos.cc |
@@ -29,6 +29,7 @@ intptr_t Socket::CreateConnect(const char* host, const intptr_t port) { |
return -1; |
} |
+ FDUtils::SetCloseOnExec(fd); |
FDUtils::SetNonBlocking(fd); |
server = gethostbyname(host); |
@@ -187,6 +188,8 @@ intptr_t ServerSocket::CreateBindListen(const char* host, |
return -1; |
} |
+ FDUtils::SetCloseOnExec(fd); |
+ |
int optval = 1; |
TEMP_FAILURE_RETRY( |
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval))); |