sanitizer_common: fix up onprint.cpp test

Commit D112602 ("sanitizer_common: tighten on_print hook test")
changed fopen to open in this test. fopen created the file
if if does not exist, but open does not. This was unnoticed
during local testing because lit is not hermetic and reuses
files from previous runs, but it started failing on bots.
Fix the open call.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D112630
This commit is contained in:
Dmitry Vyukov 2021-10-27 18:01:38 +02:00
parent 8f5cb64c71
commit 910aeed77e
1 changed files with 1 additions and 1 deletions

View File

@ -26,7 +26,7 @@ __sanitizer_on_print(const char *str) {
int main(int argc, char *argv[]) {
assert(argc >= 2);
f = open(argv[1], O_WRONLY);
f = open(argv[1], O_CREAT | O_WRONLY, 0666);
// Use-after-free to trigger ASan/TSan reports.
void *ptr = malloc(1);