Fixup for r172828: use InternalScopedBuffer in favor of large stack buffers
authorAlexey Samsonov <samsonov@google.com>
Sun, 20 Jan 2013 13:22:06 +0000 (13:22 +0000)
committerAlexey Samsonov <samsonov@google.com>
Sun, 20 Jan 2013 13:22:06 +0000 (13:22 +0000)
llvm-svn: 172975

compiler-rt/lib/sanitizer_common/sanitizer_common.cc

index 4a8d9a7..07223b2 100644 (file)
@@ -63,14 +63,14 @@ void NORETURN CheckFailed(const char *file, int line, const char *cond,
 
 static void MaybeOpenReportFile() {
   if (!log_to_file || (report_fd_pid == GetPid())) return;
-  char report_path_full[4096];
-  internal_snprintf(report_path_full, sizeof(report_path_full),
+  InternalScopedBuffer<char> report_path_full(4096);
+  internal_snprintf(report_path_full.data(), report_path_full.size(),
                     "%s.%d", report_path_prefix, GetPid());
-  fd_t fd = internal_open(report_path_full, true);
+  fd_t fd = internal_open(report_path_full.data(), true);
   if (fd == kInvalidFd) {
     report_fd = kStderrFd;
     log_to_file = false;
-    Report("ERROR: Can't open file: %s\n", report_path_full);
+    Report("ERROR: Can't open file: %s\n", report_path_full.data());
     Die();
   }
   if (report_fd != kInvalidFd) {