Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jul 13, 2024

Conversation

iii-i
Copy link
Member

@iii-i iii-i commented Jul 12, 2024

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

…or messages

"Can't open file:" and "Can't create directory:" are lacking a newline.
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 12, 2024

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Ilya Leoshkevich (iii-i)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/98626.diff

1 Files Affected:

  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_file.cpp (+3-1)
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;

@iii-i iii-i merged commit 3b7a7f4 into llvm:main Jul 13, 2024
9 checks passed
aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this pull request Jul 14, 2024
…or messages (llvm#98626)

"Can't open file:" and "Can't create directory:" are lacking a newline.
aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this pull request Jul 16, 2024
…or messages (llvm#98626)

"Can't open file:" and "Can't create directory:" are lacking a newline.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants