]> Savannah Git Hosting - gnulib.git/commitdiff
realloc-gnu: avoid glibc MALLOC_CHECK_ issue
authorPádraig Brady <P@draigBrady.com>
Sat, 15 May 2021 16:50:33 +0000 (17:50 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 15 May 2021 18:05:22 +0000 (20:05 +0200)
* tests/test-realloc-gnu.c (main): if MALLOC_CHECK_ env var
is set then don't check ENOMEM is returned from realloc().
See https://sourceware.org/bugzilla/show_bug.cgi?id=27870
Note it doesn't suffice to unsetenv() this var within the program,
as the hooks have already been set up at that stage.

ChangeLog
tests/test-realloc-gnu.c

index b802233cf8828d261fe862bae20b0a42a9ec077c..30663cb380cfd983a85cbc494ca131308e9d92c1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2021-05-15  Pádraig Brady  <P@draigBrady.com>
+
+       realloc-gnu: avoid glibc MALLOC_CHECK_ issue
+       * tests/test-realloc-gnu.c (main): if MALLOC_CHECK_ env var
+       is set then don't check ENOMEM is returned from realloc().
+       See https://sourceware.org/bugzilla/show_bug.cgi?id=27870
+       Note it doesn't suffice to unsetenv() this var within the program,
+       as the hooks have already been set up at that stage.
+
 2021-05-14  Paul Eggert  <eggert@cs.ucla.edu>
 
        c-stack: work around Solaris 11 bugs
index 3a787ed91f40cb5d16ea5dee7fca192eca090316..6f98be0bfb8cd4e5e0ded2247d5fbc18c30de8dd 100644 (file)
@@ -38,7 +38,10 @@ main (int argc, char **argv)
       size_t one = argc != 12345;
       p = realloc (p, PTRDIFF_MAX + one);
       ASSERT (p == NULL);
-      ASSERT (errno == ENOMEM);
+      /* Avoid a test failure due to glibc bug
+         <https://sourceware.org/bugzilla/show_bug.cgi?id=27870>.  */
+      if (!getenv ("MALLOC_CHECK_"))
+        ASSERT (errno == ENOMEM);
     }
 
   free (p);