Allow to build on systems without O_CLOEXEC (like CentOS 5.8 Linux).

patch from
http://bugs.python.org/issue14359
http://hg.python.org/cpython/rev/09371e2ae84d

This patch solves building failure so not bumping revision.
This commit is contained in:
reed 2013-01-09 17:01:02 +00:00
parent 8a2820b601
commit 6d9f88a97d
2 changed files with 30 additions and 1 deletions

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.3 2012/05/10 08:38:25 obache Exp $
$NetBSD: distinfo,v 1.4 2013/01/09 17:01:02 reed Exp $
SHA1 (Python-3.2.3.tar.bz2) = 4c2d562a0681ba27bc920500050e2f08de224311
RMD160 (Python-3.2.3.tar.bz2) = a4d902bc4436ea28df3d706015afd6e0f50131f4
@ -13,4 +13,5 @@ SHA1 (patch-ao) = 3dca4a62bebcfc6465a527b2e44323b8ef10d399
SHA1 (patch-au) = 6af232b3802c602f19d04049bca6a067724c2c3b
SHA1 (patch-av) = 9b44f339f65f029b7f17dbc654739a7ae3c12780
SHA1 (patch-aw) = 598e4710c426110012048946786a6d72f050e0fc
SHA1 (patch-modules__posixsubprocess.c) = 39790dbcfb0d99e7dafa6a175bb65dcfc190168f
SHA1 (patch-pyconfig.h.in) = 7ebc0ed9ca9a37c5a6c8e04cc3f7fca4a5c90e8c

View file

@ -0,0 +1,28 @@
$NetBSD: patch-modules__posixsubprocess.c,v 1.1 2013/01/09 17:01:02 reed Exp $
http://bugs.python.org/issue14359
http://hg.python.org/cpython/rev/09371e2ae84d
--- Modules/_posixsubprocess.c
+++ Modules/_posixsubprocess.c
@@ -202,7 +202,18 @@ static void
int fd_dir_fd;
if (start_fd >= end_fd)
return;
- fd_dir_fd = open(FD_DIR, O_RDONLY | O_CLOEXEC, 0);
+#ifdef O_CLOEXEC
+ fd_dir_fd = open(FD_DIR, O_RDONLY | O_CLOEXEC, 0);
+#else
+ fd_dir_fd = open(FD_DIR, O_RDONLY, 0);
+#ifdef FD_CLOEXEC
+ {
+ int old = fcntl(fd_dir_fd, F_GETFD);
+ if (old != -1)
+ fcntl(fd_dir_fd, F_SETFD, old | FD_CLOEXEC);
+ }
+#endif
+#endif
if (fd_dir_fd == -1) {
/* No way to get a list of open fds. */
_close_fds_by_brute_force(start_fd, end_fd, py_fds_to_keep);