[3.14] gh-141659: Fix bad file descriptor error in subprocess on AIX (GH-141660) (GH-141738)

/proc/self does not exist on AIX.
(cherry picked from commit 92c5de73b8)

Co-authored-by: Ayappan Perumal <ayappap2@in.ibm.com>
This commit is contained in:
Miss Islington (bot) 2025-11-19 09:05:01 +01:00 committed by GitHub
parent daff2a9c3c
commit 7cb15f93fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View file

@ -0,0 +1 @@
Fix bad file descriptor errors from ``_posixsubprocess`` on AIX.

View file

@ -514,7 +514,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,