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

Commit 0fc21808 authored by Phil Burk's avatar Phil Burk Committed by Android (Google) Code Review
Browse files

Merge "audio: use F_DUPFD_CLOEXEC to dup the MMAP buffer" into sc-dev

parents 5a5befc4 92bd526f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -59,7 +59,8 @@ SharedMemoryParcelable SharedMemoryParcelable::dup() const {
}

void SharedMemoryParcelable::setup(const unique_fd& fd, int32_t sizeInBytes) {
    mFd.reset(::dup(fd.get())); // store a duplicate fd
    constexpr int minFd = 3; // skip over stdout, stdin and stderr
    mFd.reset(fcntl(fd.get(), F_DUPFD_CLOEXEC, minFd)); // store a duplicate FD
    ALOGV("setup(fd = %d -> %d, size = %d) this = %p\n", fd.get(), mFd.get(), sizeInBytes, this);
    mSizeInBytes = sizeInBytes;
}