Ensure property_set connection sockets are CLOEXEC.

When handling a property control message to start a service, the
connection socket was being left open. The child socket FD would then be
inherited by the service from init as "/null".

Bug: 34698883

Test: adb shell start webview_zygote32; adb shell ls -l /proc/<pid>/fd,
      no "/null" FD open.

Change-Id: I25f34e1bfc1414e6143acf23414b05f5a241cace
This commit is contained in:
Robert Sesek 2017-01-25 08:08:51 -05:00
parent 894f3ea7cb
commit ca2da60206
1 changed files with 1 additions and 1 deletions

View File

@ -381,7 +381,7 @@ static void handle_property_set(SocketConnection& socket,
static void handle_property_set_fd() {
static constexpr uint32_t kDefaultSocketTimeout = 2000; /* ms */
int s = accept(property_set_fd, nullptr, nullptr);
int s = accept4(property_set_fd, nullptr, nullptr, SOCK_CLOEXEC);
if (s == -1) {
return;
}