From 7bb00ea1e322495708110c4e578f3624b8783fd6 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 17 Feb 2019 10:41:37 +0100 Subject: [PATCH] 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. --- Kernel/Process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index a9e7a28138..e2606dec28 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -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);