fix for unicode paths while writing out the submitted breakpad report file. b=382508, r=luser
authordcamp@mozilla.com
Tue, 24 Jul 2007 18:06:12 -0700
changeset 3919 846b173fd56dcb15c344ad9a3ec5bbdbcfade9b8
parent 3918 83bb708b3557a21dc708b0fe6c097ce54b63f969
child 3920 914dbc7adef28e88b6ac0458151bf775e7596628
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluser
bugs382508, 385532
milestone1.9a7pre
fix for unicode paths while writing out the submitted breakpad report file. b=382508, r=luser (last patch should have been "unblock signals on the crash reporter in linux. b=385532, r=luser")
toolkit/crashreporter/client/crashreporter.cpp
--- a/toolkit/crashreporter/client/crashreporter.cpp
+++ b/toolkit/crashreporter/client/crashreporter.cpp
@@ -272,37 +272,39 @@ static bool AddSubmittedReport(const str
     gSettingsPath + UI_DIR_SEPARATOR + "submitted";
   if (!UIEnsurePathExists(submittedDir)) {
     return false;
   }
 
   string path = submittedDir + UI_DIR_SEPARATOR +
     responseItems["CrashID"] + ".txt";
 
-  ofstream file(path.c_str());
-  if (!file.is_open())
+  ofstream* file = UIOpenWrite(path);
+  if (!file->is_open()) {
+    delete file;
     return false;
+  }
 
   char buf[1024];
   UI_SNPRINTF(buf, 1024,
               gStrings["CrashID"].c_str(),
               responseItems["CrashID"].c_str());
-  file << buf << "\n";
+  *file << buf << "\n";
 
   if (responseItems.find("ViewURL") != responseItems.end()) {
     UI_SNPRINTF(buf, 1024,
                 gStrings["CrashDetailsURL"].c_str(),
                 responseItems["ViewURL"].c_str());
-    file << buf << "\n";
+    *file << buf << "\n";
   }
 
-  file.close();
+  file->close();
+  delete file;
 
   return true;
-
 }
 
 bool SendCompleted(bool success, const string& serverResponse)
 {
   if (success) {
     const char* noDelete = getenv("MOZ_CRASHREPORTER_NO_DELETE_DUMP");
     if (!noDelete || *noDelete == '\0') {
       if (!gDumpFile.empty())