summary refs log tree commit diff
path: root/stdlib/test-bz22786.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/test-bz22786.c')
-rw-r--r--stdlib/test-bz22786.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/stdlib/test-bz22786.c b/stdlib/test-bz22786.c
index 84d3ff8cfb..df454949c4 100644
--- a/stdlib/test-bz22786.c
+++ b/stdlib/test-bz22786.c
@@ -62,12 +62,10 @@ do_test (void)
 
   /* This call crashes before the fix for bz22786 on 32-bit platforms.  */
   p = realpath (path, NULL);
-
-  if (p != NULL || errno != ENAMETOOLONG)
-    {
-      printf ("realpath: %s (%m)", p);
-      return EXIT_FAILURE;
-    }
+  TEST_VERIFY (p == NULL);
+  /* For 64-bit platforms readlink return ENAMETOOLONG, while for 32-bit
+     realpath will try to allocate a buffer larger than PTRDIFF_MAX.  */
+  TEST_VERIFY (errno == ENOMEM || errno == ENAMETOOLONG);
 
   /* Cleanup.  */
   unlink (lnk);
@@ -78,5 +76,4 @@ do_test (void)
   return 0;
 }
 
-#define TEST_FUNCTION do_test
 #include <support/test-driver.c>