summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/sanitizer_common
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2018-02-01 22:26:18 +0000
committerVitaly Buka <vitalybuka@google.com>2018-02-01 22:26:18 +0000
commitb2a27efdc0a48474e06d5794e3f9902ed9fc869d (patch)
tree2c2df9279415c721baaeeda2a919ab940334f669 /compiler-rt/test/sanitizer_common
parentb7043222bf33c2b7d0cad19795515d80a89b762f (diff)
downloadbcm5719-llvm-b2a27efdc0a48474e06d5794e3f9902ed9fc869d.tar.gz
bcm5719-llvm-b2a27efdc0a48474e06d5794e3f9902ed9fc869d.zip
[sanitizer] Fix array sizes used for path in tests
llvm-svn: 324022
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, 5 insertions, 17 deletions
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/readlink.c b/compiler-rt/test/sanitizer_common/TestCases/Posix/readlink.c
index f32cd800055..136074af63a 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix/readlink.c
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/readlink.c
@@ -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);
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/readlinkat.c b/compiler-rt/test/sanitizer_common/TestCases/Posix/readlinkat.c
index 0ac06ea616c..62ca7070d89 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix/readlinkat.c
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/readlinkat.c
@@ -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);
OpenPOWER on IntegriCloud