1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:28:11 +00:00

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
parent b6bf26430d
commit 7bb00ea1e3

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);