SystemServer: Adjust assertion+comment for new dup2() behavior

dup2(fd, fd) will no longer clear CLOEXEC on the descriptor.
This commit is contained in:
Andreas Kling 2020-08-15 11:14:09 +02:00
parent 65f2270232
commit 46e53417c9
Notes: sideshowbarker 2024-07-19 03:37:35 +09:00

View File

@ -252,10 +252,9 @@ void Service::spawn(int socket_fd)
if (socket_fd >= 0) {
ASSERT(!m_socket_path.is_null());
ASSERT(socket_fd > 2);
ASSERT(socket_fd > 3);
dup2(socket_fd, 3);
// The new descriptor is !CLOEXEC here.
// This is true even if socket_fd == 3.
setenv("SOCKET_TAKEOVER", "1", true);
}