Skip to content

Commit 7cb15f9

Browse files
[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 92c5de7) Co-authored-by: Ayappan Perumal <ayappap2@in.ibm.com>
1 parent daff2a9 commit 7cb15f9

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix bad file descriptor errors from ``_posixsubprocess`` on AIX.

Modules/_posixsubprocess.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,13 @@ _close_open_fds_maybe_unsafe(int start_fd, int *fds_to_keep,
514514
proc_fd_dir = NULL;
515515
else
516516
#endif
517+
#if defined(_AIX)
518+
char fd_path[PATH_MAX];
519+
snprintf(fd_path, sizeof(fd_path), "/proc/%ld/fd", (long)getpid());
520+
proc_fd_dir = opendir(fd_path);
521+
#else
517522
proc_fd_dir = opendir(FD_DIR);
523+
#endif
518524
if (!proc_fd_dir) {
519525
/* No way to get a list of open fds. */
520526
_close_range_except(start_fd, -1, fds_to_keep, fds_to_keep_len,

0 commit comments

Comments
 (0)