Skip to content

Commit 47995c4

Browse files
committed
Wire up closefrom for Linux
glibc-2.34 implements closefrom(3) using the same semantics as on BSD. Check for closefrom in configure and use the check result in fileutils.c rather than hardcoding a FreeBSD check (which was wrong for other BSDs anyway). Signed-off-by: Sam James <sam@gentoo.org>
1 parent 3251ba8 commit 47995c4

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

Python/fileutils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2878,9 +2878,9 @@ _Py_GetLocaleconvNumeric(struct lconv *lc,
28782878
* non-opened fd in the middle.
28792879
* 2b. If fdwalk(3) isn't available, just do a plain close(2) loop.
28802880
*/
2881-
#ifdef __FreeBSD__
2881+
#ifdef HAVE_CLOSEFROM
28822882
# define USE_CLOSEFROM
2883-
#endif /* __FreeBSD__ */
2883+
#endif /* HAVE_CLOSEFROM */
28842884

28852885
#ifdef HAVE_FDWALK
28862886
# define USE_FDWALK

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4743,7 +4743,7 @@ fi
47434743

47444744
# checks for library functions
47454745
AC_CHECK_FUNCS([ \
4746-
accept4 alarm bind_textdomain_codeset chmod chown clock close_range confstr \
4746+
accept4 alarm bind_textdomain_codeset chmod chown clock closefrom close_range confstr \
47474747
copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
47484748
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
47494749
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \

0 commit comments

Comments
 (0)