View | Details | Raw Unified | Return to bug 242274 | Differences between
and this patch

Collapse All | Expand All

(-)lang/python27/Makefile (+1 lines)
Lines 2-7 Link Here
2
2
3
PORTNAME=	python
3
PORTNAME=	python
4
PORTVERSION=	${PYTHON_PORTVERSION}
4
PORTVERSION=	${PYTHON_PORTVERSION}
5
PORTREVISION=	1
5
CATEGORIES=	lang python
6
CATEGORIES=	lang python
6
MASTER_SITES=	PYTHON/ftp/python/${PORTVERSION}
7
MASTER_SITES=	PYTHON/ftp/python/${PORTVERSION}
7
PKGNAMESUFFIX=	27
8
PKGNAMESUFFIX=	27
(-)lang/python27/files/patch-Modules_posixmodule.c (+22 lines)
Line 0 Link Here
1
--- Modules/posixmodule.c.orig	2019-10-19 18:38:44 UTC
2
+++ Modules/posixmodule.c
3
@@ -6676,9 +6676,16 @@ posix_closerange(PyObject *self, PyObject *args)
4
     if (!PyArg_ParseTuple(args, "ii:closerange", &fd_from, &fd_to))
5
         return NULL;
6
     Py_BEGIN_ALLOW_THREADS
7
-    for (i = fd_from; i < fd_to; i++)
8
-        if (_PyVerify_fd(i))
9
-            close(i);
10
+#ifdef __FreeBSD__
11
+    if (fd_to >= sysconf(_SC_OPEN_MAX)) {
12
+        closefrom(fd_from);
13
+    } else
14
+#endif
15
+    {
16
+        for (i = fd_from; i < fd_to; i++)
17
+            if (_PyVerify_fd(i))
18
+                close(i);
19
+    }
20
     Py_END_ALLOW_THREADS
21
     Py_RETURN_NONE;
22
 }
(-)lang/python35/Makefile (-1 / +1 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	python
4
PORTNAME=	python
5
PORTVERSION=	${PYTHON_PORTVERSION}
5
PORTVERSION=	${PYTHON_PORTVERSION}
6
PORTREVISION=	2
6
PORTREVISION=	3
7
CATEGORIES=	lang python
7
CATEGORIES=	lang python
8
MASTER_SITES=	PYTHON/ftp/python/${PORTVERSION}
8
MASTER_SITES=	PYTHON/ftp/python/${PORTVERSION}
9
PKGNAMESUFFIX=	${PYTHON_SUFFIX}
9
PKGNAMESUFFIX=	${PYTHON_SUFFIX}
(-)lang/python35/files/patch-Modules___posixsubprocess.c (+20 lines)
Line 0 Link Here
1
--- Modules/_posixsubprocess.c.orig	2019-11-01 23:02:34 UTC
2
+++ Modules/_posixsubprocess.c
3
@@ -233,8 +233,15 @@ _close_fds_by_brute_force(long start_fd, PyObject *py_
4
         start_fd = keep_fd + 1;
5
     }
6
     if (start_fd <= end_fd) {
7
-        for (fd_num = start_fd; fd_num < end_fd; ++fd_num) {
8
-            close(fd_num);
9
+#ifdef __FreeBSD__
10
+        if (end_fd >= sysconf(_SC_OPEN_MAX)) {
11
+            closefrom(start_fd);
12
+        } else
13
+#endif
14
+        {
15
+            for (fd_num = start_fd; fd_num < end_fd; ++fd_num) {
16
+                close(fd_num);
17
+            }
18
         }
19
     }
20
 }
(-)lang/python35/files/patch-Modules_posixmodule.c (+22 lines)
Line 0 Link Here
1
--- Modules/posixmodule.c.orig	2019-11-01 23:02:34 UTC
2
+++ Modules/posixmodule.c
3
@@ -7853,9 +7853,16 @@ os_closerange_impl(PyObject *module, int fd_low, int f
4
     int i;
5
     Py_BEGIN_ALLOW_THREADS
6
     _Py_BEGIN_SUPPRESS_IPH
7
-    for (i = fd_low; i < fd_high; i++)
8
-        if (_PyVerify_fd(i))
9
-            close(i);
10
+#ifdef __FreeBSD__
11
+    if (fd_high >= sysconf(_SC_OPEN_MAX)) {
12
+        closefrom(fd_low);
13
+    } else
14
+#endif
15
+    {
16
+        for (i = fd_low; i < fd_high; i++)
17
+            if (_PyVerify_fd(i))
18
+                close(i);
19
+    }
20
     _Py_END_SUPPRESS_IPH
21
     Py_END_ALLOW_THREADS
22
     Py_RETURN_NONE;
(-)lang/python36/Makefile (+1 lines)
Lines 3-8 Link Here
3
3
4
PORTNAME=	python
4
PORTNAME=	python
5
PORTVERSION=	${PYTHON_PORTVERSION}
5
PORTVERSION=	${PYTHON_PORTVERSION}
6
PORTREVISION=	1
6
CATEGORIES=	lang python
7
CATEGORIES=	lang python
7
MASTER_SITES=	PYTHON/ftp/python/${PORTVERSION}
8
MASTER_SITES=	PYTHON/ftp/python/${PORTVERSION}
8
PKGNAMESUFFIX=	${PYTHON_SUFFIX}
9
PKGNAMESUFFIX=	${PYTHON_SUFFIX}
(-)lang/python36/files/patch-Modules___posixsubprocess.c (+20 lines)
Line 0 Link Here
1
--- Modules/_posixsubprocess.c.orig	2019-07-02 20:25:39 UTC
2
+++ Modules/_posixsubprocess.c
3
@@ -236,8 +236,15 @@ _close_fds_by_brute_force(long start_fd, PyObject *py_
4
         start_fd = keep_fd + 1;
5
     }
6
     if (start_fd <= end_fd) {
7
-        for (fd_num = start_fd; fd_num < end_fd; ++fd_num) {
8
-            close(fd_num);
9
+#ifdef __FreeBSD__
10
+        if (end_fd >= sysconf(_SC_OPEN_MAX)) {
11
+            closefrom(start_fd);
12
+        } else
13
+#endif
14
+        {
15
+            for (fd_num = start_fd; fd_num < end_fd; ++fd_num) {
16
+                close(fd_num);
17
+            }
18
         }
19
     }
20
 }
(-)lang/python36/files/patch-Modules_posixmodule.c (+21 lines)
Line 0 Link Here
1
--- Modules/posixmodule.c.orig	2019-07-02 20:25:39 UTC
2
+++ Modules/posixmodule.c
3
@@ -7685,8 +7685,16 @@ os_closerange_impl(PyObject *module, int fd_low, int f
4
     int i;
5
     Py_BEGIN_ALLOW_THREADS
6
     _Py_BEGIN_SUPPRESS_IPH
7
-    for (i = Py_MAX(fd_low, 0); i < fd_high; i++)
8
-        close(i);
9
+    fd_low = Py_MAX(fd_low, 0);
10
+#ifdef __FreeBSD__
11
+    if (fd_high >= sysconf(_SC_OPEN_MAX)) {
12
+        closefrom(fd_low);
13
+    } else
14
+#endif
15
+    {
16
+        for (i = fd_low; i < fd_high; i++)
17
+            close(i);
18
+    }
19
     _Py_END_SUPPRESS_IPH
20
     Py_END_ALLOW_THREADS
21
     Py_RETURN_NONE;
(-)lang/python37/Makefile (+1 lines)
Lines 3-8 Link Here
3
3
4
PORTNAME=	python
4
PORTNAME=	python
5
PORTVERSION=	${PYTHON_PORTVERSION}
5
PORTVERSION=	${PYTHON_PORTVERSION}
6
PORTREVISION=	1
6
CATEGORIES=	lang python
7
CATEGORIES=	lang python
7
MASTER_SITES=	PYTHON/ftp/python/${PORTVERSION}
8
MASTER_SITES=	PYTHON/ftp/python/${PORTVERSION}
8
PKGNAMESUFFIX=	${PYTHON_SUFFIX}
9
PKGNAMESUFFIX=	${PYTHON_SUFFIX}
(-)lang/python37/files/patch-Modules___posixsubprocess.c (+20 lines)
Line 0 Link Here
1
--- Modules/_posixsubprocess.c.orig	2019-10-14 22:32:36 UTC
2
+++ Modules/_posixsubprocess.c
3
@@ -236,8 +236,15 @@ _close_fds_by_brute_force(long start_fd, PyObject *py_
4
         start_fd = keep_fd + 1;
5
     }
6
     if (start_fd <= end_fd) {
7
-        for (fd_num = start_fd; fd_num < end_fd; ++fd_num) {
8
-            close(fd_num);
9
+#ifdef __FreeBSD__
10
+        if (end_fd >= sysconf(_SC_OPEN_MAX)) {
11
+            closefrom(start_fd);
12
+        } else
13
+#endif
14
+        {
15
+            for (fd_num = start_fd; fd_num < end_fd; ++fd_num) {
16
+                close(fd_num);
17
+            }
18
         }
19
     }
20
 }
(-)lang/python37/files/patch-Modules_posixmodule.c (+21 lines)
Line 0 Link Here
1
--- Modules/posixmodule.c.orig	2019-10-14 22:32:36 UTC
2
+++ Modules/posixmodule.c
3
@@ -7810,8 +7810,16 @@ os_closerange_impl(PyObject *module, int fd_low, int f
4
     int i;
5
     Py_BEGIN_ALLOW_THREADS
6
     _Py_BEGIN_SUPPRESS_IPH
7
-    for (i = Py_MAX(fd_low, 0); i < fd_high; i++)
8
-        close(i);
9
+    fd_low = Py_MAX(fd_low, 0);
10
+#ifdef __FreeBSD__
11
+    if (fd_high >= sysconf(_SC_OPEN_MAX)) {
12
+        closefrom(fd_low);
13
+    } else
14
+#endif
15
+    {
16
+        for (i = fd_low; i < fd_high; i++)
17
+            close(i);
18
+    }
19
     _Py_END_SUPPRESS_IPH
20
     Py_END_ALLOW_THREADS
21
     Py_RETURN_NONE;
(-)lang/python38/Makefile (-1 / +1 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	python
4
PORTNAME=	python
5
PORTVERSION=	${PYTHON_PORTVERSION}
5
PORTVERSION=	${PYTHON_PORTVERSION}
6
PORTREVISION=	1
6
PORTREVISION=	2
7
CATEGORIES=	lang python
7
CATEGORIES=	lang python
8
MASTER_SITES=	PYTHON/ftp/python/${PORTVERSION}
8
MASTER_SITES=	PYTHON/ftp/python/${PORTVERSION}
9
PKGNAMESUFFIX=	${PYTHON_SUFFIX}
9
PKGNAMESUFFIX=	${PYTHON_SUFFIX}
(-)lang/python38/files/patch-Modules___posixsubprocess.c (+20 lines)
Line 0 Link Here
1
--- Modules/_posixsubprocess.c.orig	2019-10-14 13:34:47 UTC
2
+++ Modules/_posixsubprocess.c
3
@@ -236,8 +236,15 @@ _close_fds_by_brute_force(long start_fd, PyObject *py_
4
         start_fd = keep_fd + 1;
5
     }
6
     if (start_fd <= end_fd) {
7
-        for (fd_num = start_fd; fd_num < end_fd; ++fd_num) {
8
-            close(fd_num);
9
+#if defined(__FreeBSD__)
10
+        if (end_fd >= sysconf(_SC_OPEN_MAX)) {
11
+            closefrom(start_fd);
12
+        } else
13
+#endif
14
+        {
15
+            for (fd_num = start_fd; fd_num < end_fd; ++fd_num) {
16
+                close(fd_num);
17
+            }
18
         }
19
     }
20
 }
(-)lang/python38/files/patch-Modules_posixmodule.c (+21 lines)
Line 0 Link Here
1
--- Modules/posixmodule.c.orig	2019-10-14 13:34:47 UTC
2
+++ Modules/posixmodule.c
3
@@ -8460,8 +8460,16 @@ os_closerange_impl(PyObject *module, int fd_low, int f
4
     lohi[1] = fd_high;
5
     fdwalk(_fdwalk_close_func, lohi);
6
 #else
7
-    for (i = Py_MAX(fd_low, 0); i < fd_high; i++)
8
-        close(i);
9
+    fd_low = Py_MAX(fd_low, 0);
10
+#ifdef __FreeBSD__
11
+    if (fd_high >= sysconf(_SC_OPEN_MAX)) {
12
+        closefrom(fd_low);
13
+    } else
14
+#endif
15
+    {
16
+        for (i = fd_low; i < fd_high; i++)
17
+            close(i);
18
+    }
19
 #endif
20
     _Py_END_SUPPRESS_IPH
21
     Py_END_ALLOW_THREADS

Return to bug 242274