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

Commit 118d1b39 authored by Nick Kralevich's avatar Nick Kralevich
Browse files

logd_write: set SOCK_CLOEXEC on socket

Socket file descriptors remain open across exec unless
SOCK_CLOEXEC is set. Enable this option, to avoid leaking
file descriptors.

See https://android-review.googlesource.com/53736 for a similar
problem with the old logging code.

Change-Id: I9e045d2291ae6680044ab86604f3ff2c55b5eaed
parent 09117c70
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ static int __write_to_log_initialize()
        close(i);
    }

    i = socket(PF_UNIX, SOCK_DGRAM, 0);
    i = socket(PF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0);
    if (i < 0) {
        ret = -errno;
        write_to_log = __write_to_log_null;