From ff4fde767faec604958783f29fc2439b1badb0e0 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Sat, 29 Aug 2020 20:58:03 +0200 Subject: [PATCH] std: Open the eventfd fd with CLOEXEC flag Make sure the fd we use to communicate with the parent process is not leaked to the child process. Closes #5966 --- lib/std/child_process.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/child_process.zig b/lib/std/child_process.zig index 3254b958b7..a5c69c904a 100644 --- a/lib/std/child_process.zig +++ b/lib/std/child_process.zig @@ -396,7 +396,7 @@ pub const ChildProcess = struct { // and execve from the child process to the parent process. const err_pipe = blk: { if (builtin.os.tag == .linux) { - const fd = try os.eventfd(0, 0); + const fd = try os.eventfd(0, os.EFD_CLOEXEC); // There's no distinction between the readable and the writeable // end with eventfd break :blk [2]os.fd_t{ fd, fd };