summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/sanitizer_common
diff options
context:
space:
mode:
authorKuba Mracek <mracek@apple.com>2018-02-01 21:59:51 +0000
committerKuba Mracek <mracek@apple.com>2018-02-01 21:59:51 +0000
commit11ee02fd39ced1389ff109456e7172c0d9f00cf9 (patch)
tree5c47036794ff8bb1974fee36e68d2739329b1f8a /compiler-rt/test/sanitizer_common
parent26bf800625739859c4cc1c19261537687b658900 (diff)
downloadbcm5719-llvm-11ee02fd39ced1389ff109456e7172c0d9f00cf9.tar.gz
bcm5719-llvm-11ee02fd39ced1389ff109456e7172c0d9f00cf9.zip
Update readlink.c and readlinkat.c to use larger buffers on Darwin.
llvm-svn: 324016
Diffstat (limited to 'compiler-rt/test/sanitizer_common')
-rw-r--r--compiler-rt/test/sanitizer_common/TestCases/Posix/readlink.c12
-rw-r--r--compiler-rt/test/sanitizer_common/TestCases/Posix/readlinkat.c10
2 files changed, 17 insertions, 5 deletions
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/readlink.c b/compiler-rt/test/sanitizer_common/TestCases/Posix/readlink.c
index e140720b560..f32cd800055 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix/readlink.c
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/readlink.c
@@ -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);
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/readlinkat.c b/compiler-rt/test/sanitizer_common/TestCases/Posix/readlinkat.c
index e35e71e0b58..0ac06ea616c 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix/readlinkat.c
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/readlinkat.c
@@ -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);
OpenPOWER on IntegriCloud