[compiler-rt] r324016 - Update readlink.c and readlinkat.c to use larger buffers on Darwin.

Kuba Mracek via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 13:59:51 PST 2018


Author: kuba.brecka
Date: Thu Feb  1 13:59:51 2018
New Revision: 324016

URL: http://llvm.org/viewvc/llvm-project?rev=324016&view=rev
Log:
Update readlink.c and readlinkat.c to use larger buffers on Darwin.


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=324016&r1=324015&r2=324016&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 13:59:51 2018
@@ -8,20 +8,26 @@
 #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[NAME_MAX];
+  char symlink_path[LEN];
   snprintf(symlink_path, sizeof(symlink_path), "%s_%d.symlink", argv[0],
            getpid());
   int res = symlink(argv[0], symlink_path);
   assert(!res);
 
-  char readlink_path[NAME_MAX];
+  char readlink_path[LEN];
   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[NAME_MAX];
+  char readlinkat_path[LEN];
   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=324016&r1=324015&r2=324016&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 13:59:51 2018
@@ -7,14 +7,20 @@
 #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[NAME_MAX];
+  char symlink_path[LEN];
   snprintf(symlink_path, sizeof(symlink_path), "%s_%d.symlink", argv[0],
            getpid());
   int res = symlink(argv[0], symlink_path);
   assert(!res);
 
-  char readlinkat_path[NAME_MAX];
+  char readlinkat_path[LEN];
   int res2 = readlinkat(AT_FDCWD, symlink_path, readlinkat_path,
                         sizeof(readlinkat_path));
   assert(res2 >= 0);




More information about the llvm-commits mailing list