From 6546c74825ec36cf6f065f1adb366073c00433ca Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 2 May 2020 03:38:05 -0400 Subject: [PATCH] child process: no need to remove O_CLOEXEC before execve --- lib/std/child_process.zig | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/std/child_process.zig b/lib/std/child_process.zig index 6cf10664c..3e5661885 100644 --- a/lib/std/child_process.zig +++ b/lib/std/child_process.zig @@ -421,16 +421,6 @@ pub const ChildProcess = struct { } if (self.cwd_dir) |cwd| { - // Remove the O_CLOEXEC flag. This is the only safe time to do it, between fork() and execve(). - var flags = os.fcntl(cwd.fd, os.F_GETFD, 0) catch |err| switch (err) { - error.Locked => unreachable, - else => |e| forkChildErrReport(err_pipe[1], e), - }; - flags &= ~@as(u32, os.O_CLOEXEC); - _ = os.fcntl(cwd.fd, os.F_SETFD, flags) catch |err| switch (err) { - error.Locked => unreachable, - else => |e| forkChildErrReport(err_pipe[1], e), - }; os.fchdir(cwd.fd) catch |err| forkChildErrReport(err_pipe[1], err); } else if (self.cwd) |cwd| { os.chdir(cwd) catch |err| forkChildErrReport(err_pipe[1], err);