mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 22:26:06 +00:00
fuchsia: Don't fail rename if source == dest
Fuchsia errors out in rename() when source == dest. I believe this is incorrect according to http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html, but it's also relatively easy to work around in our code, and this fixes CrashReportDatabaseTest.RequestUpload. This is ZX-1729 upstream. Bug: crashpad:196 Change-Id: I27473183b04484e146a7bd9e87e60be3aeff1932 Reviewed-on: https://chromium-review.googlesource.com/923708 Reviewed-by: Mark Mentovai <mark@chromium.org> Commit-Queue: Scott Graham <scottmg@chromium.org>
This commit is contained in:
parent
0429216f59
commit
f38af628c9
@ -628,21 +628,21 @@ TEST_F(CrashReportDatabaseTest, RequestUpload) {
|
|||||||
ASSERT_EQ(pending_reports.size(), 2u);
|
ASSERT_EQ(pending_reports.size(), 2u);
|
||||||
|
|
||||||
// Check individual reports.
|
// Check individual reports.
|
||||||
const CrashReportDatabase::Report* expicitly_requested_report;
|
const CrashReportDatabase::Report* explicitly_requested_report;
|
||||||
const CrashReportDatabase::Report* pending_report;
|
const CrashReportDatabase::Report* pending_report;
|
||||||
if (pending_reports[0].uuid == report_0_uuid) {
|
if (pending_reports[0].uuid == report_0_uuid) {
|
||||||
pending_report = &pending_reports[0];
|
pending_report = &pending_reports[0];
|
||||||
expicitly_requested_report = &pending_reports[1];
|
explicitly_requested_report = &pending_reports[1];
|
||||||
} else {
|
} else {
|
||||||
pending_report = &pending_reports[1];
|
pending_report = &pending_reports[1];
|
||||||
expicitly_requested_report = &pending_reports[0];
|
explicitly_requested_report = &pending_reports[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_EQ(pending_report->uuid, report_0_uuid);
|
EXPECT_EQ(pending_report->uuid, report_0_uuid);
|
||||||
EXPECT_FALSE(pending_report->upload_explicitly_requested);
|
EXPECT_FALSE(pending_report->upload_explicitly_requested);
|
||||||
|
|
||||||
EXPECT_EQ(expicitly_requested_report->uuid, report_1_uuid);
|
EXPECT_EQ(explicitly_requested_report->uuid, report_1_uuid);
|
||||||
EXPECT_TRUE(expicitly_requested_report->upload_explicitly_requested);
|
EXPECT_TRUE(explicitly_requested_report->upload_explicitly_requested);
|
||||||
|
|
||||||
// Explicitly requested reports will not have upload_explicitly_requested bit
|
// Explicitly requested reports will not have upload_explicitly_requested bit
|
||||||
// after getting skipped.
|
// after getting skipped.
|
||||||
|
@ -65,6 +65,14 @@ bool LoggingCreateDirectory(const base::FilePath& path,
|
|||||||
|
|
||||||
bool MoveFileOrDirectory(const base::FilePath& source,
|
bool MoveFileOrDirectory(const base::FilePath& source,
|
||||||
const base::FilePath& dest) {
|
const base::FilePath& dest) {
|
||||||
|
#if defined(OS_FUCHSIA)
|
||||||
|
// Fuchsia fails and sets errno to EINVAL if source and dest are the same.
|
||||||
|
// Upstream bug is ZX-1729.
|
||||||
|
if (!source.empty() && source == dest) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif // OS_FUCHSIA
|
||||||
|
|
||||||
if (rename(source.value().c_str(), dest.value().c_str()) != 0) {
|
if (rename(source.value().c_str(), dest.value().c_str()) != 0) {
|
||||||
PLOG(ERROR) << "rename " << source.value().c_str() << ", "
|
PLOG(ERROR) << "rename " << source.value().c_str() << ", "
|
||||||
<< dest.value().c_str();
|
<< dest.value().c_str();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user