diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp index 6769d49ee12951366c4dd4f40b223d3f6180a6d7..0c7149c01c148d17cb27dae2787fee7cf73c30b8 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp @@ -93,7 +93,7 @@ static void RecursiveCreateParentDirs(char *path) { if (!IsPathSeparator(path[i])) continue; path[i] = '\0'; - if (!DirExists(path) && !CreateDir(path)) { + if (common_flags()->check_log_path_on_init && !DirExists(path) && !CreateDir(path)) { // OHOS_LOCAL const char *ErrorMsgPrefix = "ERROR: Can't create directory: "; WriteToFile(kStderrFd, ErrorMsgPrefix, internal_strlen(ErrorMsgPrefix)); WriteToFile(kStderrFd, path, internal_strlen(path)); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc b/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc index 509bcf6afd1af8dc6f0c5b0376aed036e2749c24..15a253feb1168371961a2e16032a9c6e8287fdcf 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc @@ -19,6 +19,12 @@ // Default value must be a compile-time constant. // Description must be a string literal. +// OHOS_LOCAL begin +COMMON_FLAG( + bool, check_log_path_on_init, true, + "If set, log_path will be checked during initialization.") +// OHOS_LOCAL end + COMMON_FLAG( bool, symbolize, true, "If set, use the online symbolizer from common sanitizer runtime to turn "