[compiler-rt] a871c34 - sanitizer_common: fix up onprint.cpp test more

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 29 04:44:08 PDT 2021


Author: Dmitry Vyukov
Date: 2021-10-29T13:44:04+02:00
New Revision: a871c34e8d400e83f60320b51f19f0cb33eb7ade

URL: https://github.com/llvm/llvm-project/commit/a871c34e8d400e83f60320b51f19f0cb33eb7ade
DIFF: https://github.com/llvm/llvm-project/commit/a871c34e8d400e83f60320b51f19f0cb33eb7ade.diff

LOG: 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

Added: 
    

Modified: 
    compiler-rt/test/sanitizer_common/TestCases/onprint.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/sanitizer_common/TestCases/onprint.cpp b/compiler-rt/test/sanitizer_common/TestCases/onprint.cpp
index 29e38fae3ce38..5c23d4d51a4da 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);


        


More information about the llvm-commits mailing list