Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: client/crash_report_database_mac.mm

Issue 1000263003: Add MinidumpCrashpadInfo::report_id (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/crash_report_database.h ('k') | client/crash_report_database_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/crash_report_database_mac.mm
diff --git a/client/crash_report_database_mac.mm b/client/crash_report_database_mac.mm
index b849bb0f66ba365011e397e9205a19cfa0520dd9..d588f7658cc26225cce860c604c685e19dd91914 100644
--- a/client/crash_report_database_mac.mm
+++ b/client/crash_report_database_mac.mm
@@ -238,15 +238,15 @@ CrashReportDatabase::OperationStatus
CrashReportDatabaseMac::PrepareNewCrashReport(NewReport** out_report) {
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
+ scoped_ptr<NewReport> report(new NewReport());
+
uuid_t uuid_gen;
uuid_generate(uuid_gen);
- UUID uuid(uuid_gen);
-
- scoped_ptr<NewReport> report(new NewReport());
+ report->uuid.InitializeFromBytes(uuid_gen);
report->path =
base_dir_.Append(kWriteDirectory)
- .Append(uuid.ToString() + "." + kCrashReportFileExtension);
+ .Append(report->uuid.ToString() + "." + kCrashReportFileExtension);
report->handle = HANDLE_EINTR(open(report->path.value().c_str(),
O_CREAT | O_WRONLY | O_EXCL | O_EXLOCK,
@@ -257,7 +257,8 @@ CrashReportDatabaseMac::PrepareNewCrashReport(NewReport** out_report) {
}
// TODO(rsesek): Potentially use an fsetxattr() here instead.
- if (!WriteXattr(report->path, XattrName(kXattrUUID), uuid.ToString())) {
+ if (!WriteXattr(
+ report->path, XattrName(kXattrUUID), report->uuid.ToString())) {
PLOG_IF(ERROR, IGNORE_EINTR(close(report->handle)) != 0) << "close";
return kDatabaseError;
}
@@ -288,6 +289,11 @@ CrashReportDatabaseMac::FinishedWritingCrashReport(NewReport* report,
return kDatabaseError;
}
+ if (*uuid != report->uuid) {
+ LOG(ERROR) << "UUID mismatch for crash report " << report->path.value();
+ return kDatabaseError;
+ }
+
// Record the creation time of this report.
if (!WriteXattrTimeT(report->path, XattrName(kXattrCreationTime),
time(nullptr))) {
« no previous file with comments | « client/crash_report_database.h ('k') | client/crash_report_database_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698