From a871c34e8d400e83f60320b51f19f0cb33eb7ade Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 29 Oct 2021 10:17:18 +0200 Subject: [PATCH] sanitizer_common: fix up onprint.cpp test more D112630 ("sanitizer_common: fix up onprint.cpp test") added O_CREAT, but we also need O_TRUNC b/c the file may not exist, or may exist as well. Reviewed By: melver Differential Revision: https://reviews.llvm.org/D112788 --- compiler-rt/test/sanitizer_common/TestCases/onprint.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler-rt/test/sanitizer_common/TestCases/onprint.cpp b/compiler-rt/test/sanitizer_common/TestCases/onprint.cpp index 29e38fae3ce3..5c23d4d51a4d 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/onprint.cpp +++ b/compiler-rt/test/sanitizer_common/TestCases/onprint.cpp @@ -26,7 +26,7 @@ __sanitizer_on_print(const char *str) { int main(int argc, char *argv[]) { assert(argc >= 2); - f = open(argv[1], O_CREAT | O_WRONLY, 0666); + f = open(argv[1], O_CREAT | O_TRUNC | O_WRONLY, 0666); // Use-after-free to trigger ASan/TSan reports. void *ptr = malloc(1);