Skip to content

Commit af94f62

Browse files
hugovkayappanec
andauthored
[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>
1 parent 5285ccc commit af94f62

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
@@ -512,7 +512,13 @@ _close_open_fds_maybe_unsafe(int start_fd, int *fds_to_keep,
512512
proc_fd_dir = NULL;
513513
else
514514
#endif
515+
#if defined(_AIX)
516+
char fd_path[PATH_MAX];
517+
snprintf(fd_path, sizeof(fd_path), "/proc/%ld/fd", (long)getpid());
518+
proc_fd_dir = opendir(fd_path);
519+
#else
515520
proc_fd_dir = opendir(FD_DIR);
521+
#endif
516522
if (!proc_fd_dir) {
517523
/* No way to get a list of open fds. */
518524
_close_range_except(start_fd, -1, fds_to_keep, fds_to_keep_len,

0 commit comments

Comments
 (0)