summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2019-08-05 15:31:38 +0300
committerAndreas Kling <awesomekling@gmail.com>2019-08-05 16:04:31 +0200
commit211b51dab7be118ee2958eed003461808849b86d (patch)
tree6d81d8de8e5202d1d7a7e2cbeef68a2a833711a5
parent9c3b1ca0c62fc329bdc1fb86bc7b11fc7b8791b9 (diff)
downloadserenity-211b51dab7be118ee2958eed003461808849b86d.zip
CEventLoop: Create the wake pipe with O_CLOEXEC
This ensures the pipe fds don't leak into child processes. This manifested as the Shell (and all processes started from the shell) having two mysterious FIFOs open. This was happening because of the Terminal, which the shell was spawned form, leaking its CEventLoop wake pipe fds.
-rw-r--r--Libraries/LibCore/CEventLoop.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Libraries/LibCore/CEventLoop.cpp b/Libraries/LibCore/CEventLoop.cpp
index 8d8a786f8e..2e50891b15 100644
--- a/Libraries/LibCore/CEventLoop.cpp
+++ b/Libraries/LibCore/CEventLoop.cpp
@@ -36,7 +36,7 @@ CEventLoop::CEventLoop()
if (!s_main_event_loop) {
s_main_event_loop = this;
- int rc = pipe(s_wake_pipe_fds);
+ int rc = pipe2(s_wake_pipe_fds, O_CLOEXEC);
ASSERT(rc == 0);
s_event_loop_stack->append(this);
}