From 5f59a34ab747dde8ede7357f3431bf06bd6002fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 8 Mar 2026 17:28:33 +0100 Subject: New upstream version 1.4.2 --- gnulib-m4/realloc.m4 | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) (limited to 'gnulib-m4/realloc.m4') diff --git a/gnulib-m4/realloc.m4 b/gnulib-m4/realloc.m4 index 0242abdc..8938db92 100644 --- a/gnulib-m4/realloc.m4 +++ b/gnulib-m4/realloc.m4 @@ -1,6 +1,6 @@ # realloc.m4 -# serial 39 -dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. +# serial 40 +dnl Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -27,13 +27,54 @@ AC_DEFUN([gl_FUNC_REALLOC_POSIX], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether realloc sets errno on failure], + [gl_cv_func_realloc_posix], + [ + dnl FreeBSD 15.0 realloc() does not set errno when asked for more than + dnl 0x7000000000000000 bytes. + case "$host_os" in + darwin* | freebsd* | dragonfly* | midnightbsd* | netbsd* | openbsd*) + AC_RUN_IFELSE( + [AC_LANG_SOURCE( + [[#include + #include + int main (int argc, char **argv) + { + void *p; + errno = 1729; + p = realloc (malloc (1), (size_t)(-1) / 100 * 49); + return (!p && errno == 1729); + } + ]]) + ], + [gl_cv_func_realloc_posix=yes], + [gl_cv_func_realloc_posix=no], + [case "$host_os" in + freebsd*) gl_cv_func_realloc_posix="guessing no" ;; + *) gl_cv_func_realloc_posix="guessing yes" ;; + esac + ]) + ;; + *) + gl_cv_func_realloc_posix="$gl_cv_func_malloc_posix" + ;; + esac + ]) + case "$gl_cv_func_realloc_posix" in + *yes) + AC_DEFINE([HAVE_REALLOC_POSIX], [1], + [Define if realloc sets errno on allocation failure.]) + ;; + *) + REPLACE_REALLOC_FOR_REALLOC_POSIX=1 + ;; + esac AC_REQUIRE([gl_FUNC_REALLOC_SANITIZED]) if test "$gl_cv_func_realloc_sanitize" != no; then REPLACE_REALLOC_FOR_REALLOC_POSIX=1 AC_DEFINE([NEED_SANITIZED_REALLOC], [1], [Define to 1 if realloc should abort upon undefined behaviour.]) - else - REPLACE_REALLOC_FOR_REALLOC_POSIX=$REPLACE_MALLOC_FOR_MALLOC_POSIX fi ]) -- cgit v1.2.3