[compiler-rt] r324022 - [sanitizer] Fix array sizes used for path in tests

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 14:26:19 PST 2018


Author: vitalybuka
Date: Thu Feb  1 14:26:18 2018
New Revision: 324022

URL: http://llvm.org/viewvc/llvm-project?rev=324022&view=rev
Log:
[sanitizer] Fix array sizes used for path in tests

Modified:
    compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlink.c
    compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlinkat.c

Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlink.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlink.c?rev=324022&r1=324021&r2=324022&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlink.c (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlink.c Thu Feb  1 14:26:18 2018
@@ -8,26 +8,20 @@
 #include <sys/types.h>
 #include <unistd.h>
 
-#ifdef __APPLE__
-#define LEN PATH_MAX
-#else
-#define LEN NAME_MAX
-#endif
-
 int main(int argc, char **argv) {
-  char symlink_path[LEN];
+  char symlink_path[PATH_MAX];
   snprintf(symlink_path, sizeof(symlink_path), "%s_%d.symlink", argv[0],
            getpid());
   int res = symlink(argv[0], symlink_path);
   assert(!res);
 
-  char readlink_path[LEN];
+  char readlink_path[PATH_MAX];
   ssize_t res2 = readlink(symlink_path, readlink_path, sizeof(readlink_path));
   assert(res2 >= 0);
   readlink_path[res2] = '\0';
   assert(!strcmp(readlink_path, argv[0]));
 
-  char readlinkat_path[LEN];
+  char readlinkat_path[PATH_MAX];
   res2 = readlinkat(AT_FDCWD, symlink_path, readlinkat_path,
                     sizeof(readlink_path));
   assert(res2 >= 0);

Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlinkat.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlinkat.c?rev=324022&r1=324021&r2=324022&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlinkat.c (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/readlinkat.c Thu Feb  1 14:26:18 2018
@@ -7,20 +7,14 @@
 #include <string.h>
 #include <unistd.h>
 
-#ifdef __APPLE__
-#define LEN PATH_MAX
-#else
-#define LEN NAME_MAX
-#endif
-
 int main(int argc, char **argv) {
-  char symlink_path[LEN];
+  char symlink_path[PATH_MAX];
   snprintf(symlink_path, sizeof(symlink_path), "%s_%d.symlink", argv[0],
            getpid());
   int res = symlink(argv[0], symlink_path);
   assert(!res);
 
-  char readlinkat_path[LEN];
+  char readlinkat_path[PATH_MAX];
   int res2 = readlinkat(AT_FDCWD, symlink_path, readlinkat_path,
                         sizeof(readlinkat_path));
   assert(res2 >= 0);




More information about the llvm-commits mailing list