diff options
| author | justdan6 <134341009+justdan6@users.noreply.github.com> | 2023-07-28 22:08:43 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-28 22:08:43 (GMT) |
| commit | 11c055f5ff1a353de6d2e77f2af24aaa782878ba (patch) | |
| tree | 97823095e5ce4284e54e9735c29ae71167426c43 | |
| parent | cf63df88d38ec3e6ebd44ed184312df9f07f9782 (diff) | |
| download | cpython-11c055f5ff1a353de6d2e77f2af24aaa782878ba.zip cpython-11c055f5ff1a353de6d2e77f2af24aaa782878ba.tar.gz cpython-11c055f5ff1a353de6d2e77f2af24aaa782878ba.tar.bz2 | |
gh-106881: Check for linux/limits.h before including it (#107397)
* Check for linux/limits.h before including it
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
| -rw-r--r-- | Misc/NEWS.d/next/Build/2023-07-28-18-17-33.gh-issue-106881.U3Ezdq.rst | 1 | ||||
| -rw-r--r-- | Modules/posixmodule.c | 2 | ||||
| -rwxr-xr-x | configure | 6 | ||||
| -rw-r--r-- | configure.ac | 2 | ||||
| -rw-r--r-- | pyconfig.h.in | 3 |
5 files changed, 12 insertions, 2 deletions
diff --git a/Misc/NEWS.d/next/Build/2023-07-28-18-17-33.gh-issue-106881.U3Ezdq.rst b/Misc/NEWS.d/next/Build/2023-07-28-18-17-33.gh-issue-106881.U3Ezdq.rst new file mode 100644 index 0000000..40b2609 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2023-07-28-18-17-33.gh-issue-106881.U3Ezdq.rst @@ -0,0 +1 @@ +Check for `linux/limits.h` before including it in `Modules/posixmodule.c`. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index bab2ac2..a42e41c 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -285,7 +285,7 @@ corresponding Unix manual entries for more information on calls."); # undef HAVE_SCHED_SETAFFINITY #endif -#if defined(HAVE_SYS_XATTR_H) && defined(__linux__) && !defined(__FreeBSD_kernel__) && !defined(__GNU__) +#if defined(HAVE_SYS_XATTR_H) && defined(HAVE_LINUX_LIMITS_H) && !defined(__FreeBSD_kernel__) && !defined(__GNU__) # define USE_XATTRS # include <linux/limits.h> // Needed for XATTR_SIZE_MAX on musl libc. #endif @@ -10550,6 +10550,12 @@ then : printf "%s\n" "#define HAVE_LINUX_FS_H 1" >>confdefs.h fi +ac_fn_c_check_header_compile "$LINENO" "linux/limits.h" "ac_cv_header_linux_limits_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_limits_h" = xyes +then : + printf "%s\n" "#define HAVE_LINUX_LIMITS_H 1" >>confdefs.h + +fi ac_fn_c_check_header_compile "$LINENO" "linux/memfd.h" "ac_cv_header_linux_memfd_h" "$ac_includes_default" if test "x$ac_cv_header_linux_memfd_h" = xyes then : diff --git a/configure.ac b/configure.ac index cdb88a3..8a84eaf 100644 --- a/configure.ac +++ b/configure.ac @@ -2848,7 +2848,7 @@ AC_DEFINE([STDC_HEADERS], [1], # checks for header files AC_CHECK_HEADERS([ \ alloca.h asm/types.h bluetooth.h conio.h direct.h dlfcn.h endian.h errno.h fcntl.h grp.h \ - ieeefp.h io.h langinfo.h libintl.h libutil.h linux/auxvec.h sys/auxv.h linux/fs.h linux/memfd.h \ + ieeefp.h io.h langinfo.h libintl.h libutil.h linux/auxvec.h sys/auxv.h linux/fs.h linux/limits.h linux/memfd.h \ linux/random.h linux/soundcard.h \ linux/tipc.h linux/wait.h netdb.h net/ethernet.h netinet/in.h netpacket/packet.h poll.h process.h pthread.h pty.h \ sched.h setjmp.h shadow.h signal.h spawn.h stropts.h sys/audioio.h sys/bsdtty.h sys/devpoll.h \ diff --git a/pyconfig.h.in b/pyconfig.h.in index 0828dc8..dab8ebf 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -721,6 +721,9 @@ /* Define to 1 if you have the <linux/fs.h> header file. */ #undef HAVE_LINUX_FS_H +/* Define to 1 if you have the <linux/limits.h> header file. */ +#undef HAVE_LINUX_LIMITS_H + /* Define to 1 if you have the <linux/memfd.h> header file. */ #undef HAVE_LINUX_MEMFD_H |
