From: Elliott Hughes Date: Tue, 23 Sep 2014 00:43:09 +0000 (-0700) Subject: Fix a couple more cases of missing CLOEXEC. X-Git-Tag: android-x86-6.0-r1~14^2^2~38 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=748fbe5c41d97433dc756a50812e1caf6a6ef727;p=android-x86%2Fbionic.git Fix a couple more cases of missing CLOEXEC. The debuggerd case can probably never happen, because you're crashing at this point anyway. The system property one seems possible though. Bug: 18186310 (cherry picked from commit 0dc39f9952c5e3a3121ea77357bb264ef0f8ded7) Change-Id: I3e84488fc246f6c28cbd82e96d0cd4343a12c28a --- diff --git a/libc/bionic/system_properties.cpp b/libc/bionic/system_properties.cpp index a564c3939..0e16bf314 100644 --- a/libc/bionic/system_properties.cpp +++ b/libc/bionic/system_properties.cpp @@ -475,8 +475,8 @@ static const prop_info *find_property(prop_bt *const trie, const char *name, static int send_prop_msg(const prop_msg *msg) { - const int fd = socket(AF_LOCAL, SOCK_STREAM, 0); - if (fd < 0) { + const int fd = socket(AF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0); + if (fd == -1) { return -1; } diff --git a/linker/debugger.cpp b/linker/debugger.cpp index 6565985b5..ac466a5b4 100644 --- a/linker/debugger.cpp +++ b/linker/debugger.cpp @@ -215,7 +215,7 @@ static void send_debuggerd_packet(siginfo_t* info) { return; } - int s = socket_abstract_client(DEBUGGER_SOCKET_NAME, SOCK_STREAM); + int s = socket_abstract_client(DEBUGGER_SOCKET_NAME, SOCK_STREAM | SOCK_CLOEXEC); if (s == -1) { __libc_format_log(ANDROID_LOG_FATAL, "libc", "Unable to open connection to debuggerd: %s", strerror(errno));