Index: runtime/bin/socket_linux.cc |
diff --git a/runtime/bin/socket_linux.cc b/runtime/bin/socket_linux.cc |
index 896a9da069497bda67f02e03bc55b4a6831ebaf8..89dd267b6dace61675b6fb74c15b92b97fe54e1e 100644 |
--- a/runtime/bin/socket_linux.cc |
+++ b/runtime/bin/socket_linux.cc |
@@ -29,6 +29,7 @@ intptr_t Socket::CreateConnect(const char* host, const intptr_t port) { |
return -1; |
} |
+ FDUtils::SetCloseOnExec(fd); |
FDUtils::SetNonBlocking(fd); |
static const size_t kTempBufSize = 1024; |
@@ -191,6 +192,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))); |