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

Commit 5ca3af31 authored by Nick Kralevich's avatar Nick Kralevich
Browse files

com_android_internal_os_AtomicDirectory.cpp: add O_CLOEXEC

Ensure that file descriptors don't leak across an execve() boundary by
adding O_CLOEXEC

Test: compiles and boots
Change-Id: I7bd4b5aa03adf0ac372575b5251226f8b5e231ff
parent 31f977a4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ static jint com_android_internal_os_AtomicDirectory_getDirectoryFd(JNIEnv* env,
        return -1;
    }
    int fd;
    if ((fd = TEMP_FAILURE_RETRY(open(path8.c_str(), O_DIRECTORY | O_RDONLY))) == -1) {
    if ((fd = TEMP_FAILURE_RETRY(open(path8.c_str(), O_DIRECTORY | O_RDONLY | O_CLOEXEC))) == -1) {
        ALOGE("Cannot open directory %s, error: %s\n", path8.c_str(), strerror(errno));
        return -1;
    }