From: Bruno Haible Date: Fri, 14 May 2021 17:04:05 +0000 (+0200) Subject: malloc-gnu, realloc-gnu, calloc-gnu: Ensure errno gets set to ENOMEM. X-Git-Tag: v1.0~2888 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=29d84f9d076190f7f0a0bae3cacb91a89dbdac61;p=thirdparty%2Fgnulib.git malloc-gnu, realloc-gnu, calloc-gnu: Ensure errno gets set to ENOMEM. * m4/malloc.m4 (gl_CHECK_MALLOC_POSIX): Set gl_cv_func_malloc_posix to 'no' also on Solaris. --- diff --git a/ChangeLog b/ChangeLog index 8136a34388..191f4549e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2021-05-14 Bruno Haible + + malloc-gnu, realloc-gnu, calloc-gnu: Ensure errno gets set to ENOMEM. + * m4/malloc.m4 (gl_CHECK_MALLOC_POSIX): Set gl_cv_func_malloc_posix to + 'no' also on Solaris. + 2021-05-14 Bruno Haible DEPENDENCIES: Mention the requirement for 'join'. diff --git a/m4/malloc.m4 b/m4/malloc.m4 index 6fcd4adb67..972e808ab7 100644 --- a/m4/malloc.m4 +++ b/m4/malloc.m4 @@ -1,4 +1,4 @@ -# malloc.m4 serial 26 +# malloc.m4 serial 27 dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -113,7 +113,7 @@ AC_DEFUN([gl_FUNC_MALLOC_POSIX], fi ]) -# Test whether malloc, realloc, calloc set errno on failure. +# Test whether malloc, realloc, calloc set errno to ENOMEM on failure. # Set gl_cv_func_malloc_posix to yes or no accordingly. AC_DEFUN([gl_CHECK_MALLOC_POSIX], [ @@ -129,9 +129,13 @@ AC_DEFUN([gl_CHECK_MALLOC_POSIX], case "$host_os" in mingw*) gl_cv_func_malloc_posix=no ;; - irix*) - dnl The three functions return NULL with errno unset when the - dnl argument is larger than PTRDIFF_MAX. Here is a test program: + irix* | solaris*) + dnl On IRIX 6.5, the three functions return NULL with errno unset + dnl when the argument is larger than PTRDIFF_MAX. + dnl On Solaris 11.3, the three functions return NULL with errno set + dnl to EAGAIN, not ENOMEM, when the argument is larger than + dnl PTRDIFF_MAX. + dnl Here is a test program: m4_divert_push([KILL]) #include #include