Index: runtime/bin/socket_android.cc |
diff --git a/runtime/bin/socket_android.cc b/runtime/bin/socket_android.cc |
index d4960f6e23964566bcab6e17157c1502914e9d6e..eac7d1239fac8c153ee7cc9fba6e169e8c9ba9f6 100644 |
--- a/runtime/bin/socket_android.cc |
+++ b/runtime/bin/socket_android.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); |
@@ -188,6 +189,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))); |