[compiler-rt] 3b7a7f4 - [sanitizer] Add missing newlines to __sanitizer_set_report_path() error messages (#98626)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 13 01:31:07 PDT 2024


Author: Ilya Leoshkevich
Date: 2024-07-13T10:31:03+02:00
New Revision: 3b7a7f4cc43f90e79292700959c55a62ab87fd9a

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

LOG: [sanitizer] Add missing newlines to __sanitizer_set_report_path() error messages (#98626)

"Can't open file:" and "Can't create directory:" are lacking a newline.

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_file.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp
index 7ef499ce07b13..96af270f9d8b5 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp
@@ -69,7 +69,7 @@ void ReportFile::ReopenIfNecessary() {
     WriteToFile(kStderrFd, ErrorMsgPrefix, internal_strlen(ErrorMsgPrefix));
     WriteToFile(kStderrFd, full_path, internal_strlen(full_path));
     char errmsg[100];
-    internal_snprintf(errmsg, sizeof(errmsg), " (reason: %d)", err);
+    internal_snprintf(errmsg, sizeof(errmsg), " (reason: %d)\n", err);
     WriteToFile(kStderrFd, errmsg, internal_strlen(errmsg));
     Die();
   }
@@ -88,6 +88,8 @@ static void RecursiveCreateParentDirs(char *path) {
       const char *ErrorMsgPrefix = "ERROR: Can't create directory: ";
       WriteToFile(kStderrFd, ErrorMsgPrefix, internal_strlen(ErrorMsgPrefix));
       WriteToFile(kStderrFd, path, internal_strlen(path));
+      const char *ErrorMsgSuffix = "\n";
+      WriteToFile(kStderrFd, ErrorMsgSuffix, internal_strlen(ErrorMsgSuffix));
       Die();
     }
     path[i] = save;


        


More information about the llvm-commits mailing list