ソースを参照

os2: CLOEXEC the fds from `pipe` for posix implementation

Laytan Laats 1 年間 前
コミット
963e8544f4
1 ファイル変更9 行追加0 行削除
  1. 9 0
      core/os/os2/pipe_posix.odin

+ 9 - 0
core/os/os2/pipe_posix.odin

@@ -12,6 +12,15 @@ _pipe :: proc() -> (r, w: ^File, err: Error) {
 		return
 		return
 	}
 	}
 
 
+	if posix.fcntl(fds[0], .SETFD, i32(posix.FD_CLOEXEC)) == -1 {
+		err = _get_platform_error()
+		return
+	}
+	if posix.fcntl(fds[1], .SETFD, i32(posix.FD_CLOEXEC)) == -1 {
+		err = _get_platform_error()
+		return
+	}
+
 	r = __new_file(fds[0])
 	r = __new_file(fds[0])
 	ri := (^File_Impl)(r.impl)
 	ri := (^File_Impl)(r.impl)