Kernel: socket() with SOCK_CLOEXEC was setting the wrong fd flag.

Turns out FD_CLOEXEC and O_CLOEXEC are different values. Silly mistake.
I noticed that Terminal's shell process still had the Terminal's window
server connection open, albeit in a broken state.
This commit is contained in:
Andreas Kling 2019-02-17 10:41:37 +01:00
commit 7bb00ea1e3
Notes: sideshowbarker 2024-07-19 15:40:52 +09:00

View file

@ -2236,7 +2236,7 @@ int Process::sys$socket(int domain, int type, int protocol)
auto descriptor = FileDescriptor::create(move(socket));
unsigned flags = 0;
if (type & SOCK_CLOEXEC)
flags |= O_CLOEXEC;
flags |= FD_CLOEXEC;
if (type & SOCK_NONBLOCK)
descriptor->set_blocking(false);
m_fds[fd].set(move(descriptor), flags);