ios: Fail Crashpad initialization with invalid database path.

Bug: crashpad:31
Change-Id: I1853af83a18675bee6dd99636f179db127e1ac47
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3247291
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
This commit is contained in:
Justin Cohen 2021-10-27 12:31:45 -04:00 committed by Crashpad LUCI CQ
parent 9c6a751e4b
commit 15c4663b8c

View File

@ -28,13 +28,15 @@
namespace {
// Creates directory at |path|.
void CreateDirectory(const base::FilePath& path) {
bool CreateDirectory(const base::FilePath& path) {
if (mkdir(path.value().c_str(), 0755) == 0) {
return;
return true;
}
if (errno != EEXIST) {
PLOG(ERROR) << "mkdir " << path.value();
return false;
}
return true;
}
// The file extension used to indicate a file is locked.
@ -63,6 +65,9 @@ bool InProcessHandler::Initialize(
INITIALIZATION_STATE_SET_INITIALIZING(initialized_);
annotations_ = annotations;
database_ = CrashReportDatabase::Initialize(database);
if (!database_) {
return false;
}
bundle_identifier_and_seperator_ =
system_data.BundleIdentifier() + kBundleSeperator;
@ -80,11 +85,13 @@ bool InProcessHandler::Initialize(
database_.get(), url, upload_thread_options));
}
CreateDirectory(database);
if (!CreateDirectory(database))
return false;
static constexpr char kPendingSerializediOSDump[] =
"pending-serialized-ios-dump";
base_dir_ = database.Append(kPendingSerializediOSDump);
CreateDirectory(base_dir_);
if (!CreateDirectory(base_dir_))
return false;
prune_thread_.reset(new PruneIntermediateDumpsAndCrashReportsThread(
database_.get(),