summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2019-01-11 05:53:09 +0000
committerDavid Carlier <devnexen@gmail.com>2019-01-11 05:53:09 +0000
commit8a81b29215c75b5010c5c68b83d8bd2c99595ba2 (patch)
treef1410c85d266e96ea3a4fea4b56c3ca76dedc00a /compiler-rt/test
parentb97885cc2eb06a29141b6ea67413f8ff17afcc10 (diff)
downloadbcm5719-llvm-8a81b29215c75b5010c5c68b83d8bd2c99595ba2.tar.gz
bcm5719-llvm-8a81b29215c75b5010c5c68b83d8bd2c99595ba2.zip
[Sanitizer] Intercept getusershell
- If entries are properly copied (there were a bug in FreeBSD implementation in earlier version), or list properly reset. Reviewers: vitalybuka, krytarowski Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D56562 llvm-svn: 350919
Diffstat (limited to 'compiler-rt/test')
-rw-r--r--compiler-rt/test/sanitizer_common/TestCases/Posix/getusershell.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/getusershell.cc b/compiler-rt/test/sanitizer_common/TestCases/Posix/getusershell.cc
new file mode 100644
index 00000000000..6ad1c5bd17a
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/getusershell.cc
@@ -0,0 +1,21 @@
+// RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+
+int main(void) {
+ printf("getusershell\n");
+
+ setusershell();
+ char *fentry = getusershell();
+
+ printf("First entry: '%s'\n", fentry);
+
+ endusershell();
+
+ return 0;
+ // CHECK: getusershell
+ // CHECK: First entry: '{{.*}}'
+}
OpenPOWER on IntegriCloud