[3.13] gh-141659: Fix bad file descriptor error in subprocess on AIX (GH-141660) (#141828)

Co-authored-by: Ayappan Perumal <ayappap2@in.ibm.com>
This commit is contained in:
Hugo van Kemenade
2025-11-21 20:10:01 +02:00
committed by GitHub
parent 5285ccc19e
commit af94f62bf6
2 changed files with 7 additions and 0 deletions
@@ -0,0 +1 @@
Fix bad file descriptor errors from ``_posixsubprocess`` on AIX.
+6
View File
@@ -512,7 +512,13 @@ _close_open_fds_maybe_unsafe(int start_fd, int *fds_to_keep,
proc_fd_dir = NULL;
else
#endif
#if defined(_AIX)
char fd_path[PATH_MAX];
snprintf(fd_path, sizeof(fd_path), "/proc/%ld/fd", (long)getpid());
proc_fd_dir = opendir(fd_path);
#else
proc_fd_dir = opendir(FD_DIR);
#endif
if (!proc_fd_dir) {
/* No way to get a list of open fds. */
_close_range_except(start_fd, -1, fds_to_keep, fds_to_keep_len,