Browse Source

update malloc(0) check to handle expected behavior based upon config options

Mike Frysinger 19 years ago
parent
commit
a3e9840d06
1 changed files with 5 additions and 0 deletions
  1. 5 0
      test/malloc/tst-mcheck.c

+ 5 - 0
test/malloc/tst-mcheck.c

@@ -20,6 +20,7 @@
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <features.h>
 
 static int errors = 0;
 
@@ -53,7 +54,11 @@ main (void)
     merror ("realloc (p, 0) failed.");
 
   p = malloc (0);
+#if !defined(__UCLIBC__) || defined(__MALLOC_GLIBC_COMPAT__)
   if (p == NULL)
+#else
+  if (p != NULL)
+#endif
     merror ("malloc (0) failed.");
 
   p = realloc (p, 0);