Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca2da602 authored by Robert Sesek's avatar Robert Sesek
Browse files

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
parent 894f3ea7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
    }