stdlib: Sync canonicalize with gnulib [BZ #10635] [BZ #26592] [BZ #26341] [BZ #24970]
[platform/upstream/glibc.git] / stdlib / test-bz22786.c
index 84d3ff8..df45494 100644 (file)
@@ -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>