]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-141659: Fix bad file descriptor error in subprocess on AIX (GH-141660)...
authorHugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Fri, 21 Nov 2025 18:10:01 +0000 (20:10 +0200)
committerGitHub <noreply@github.com>
Fri, 21 Nov 2025 18:10:01 +0000 (18:10 +0000)
Co-authored-by: Ayappan Perumal <ayappap2@in.ibm.com>
Misc/NEWS.d/next/Library/2025-11-17-08-16-30.gh-issue-141659.QNi9Aj.rst [new file with mode: 0644]
Modules/_posixsubprocess.c

diff --git a/Misc/NEWS.d/next/Library/2025-11-17-08-16-30.gh-issue-141659.QNi9Aj.rst b/Misc/NEWS.d/next/Library/2025-11-17-08-16-30.gh-issue-141659.QNi9Aj.rst
new file mode 100644 (file)
index 0000000..eeb055c
--- /dev/null
@@ -0,0 +1 @@
+Fix bad file descriptor errors from ``_posixsubprocess`` on AIX.
index b5326314677d62df083734c58564d596cb729e4b..0a7ef74e26fac363b511aa9ab5245bc1c4327fce 100644 (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,