Delete FilesystemInterface::CopyFile.
Only use of this method was to implement the cross-device case of
MoveFile on unix systems.
In turn, only use of the MoveFile method is in
FileRotatingStream::RotateFiles. Since file rotation should never
involve any copying of log data, the MoveFile fallback to copying can
be deleted.
BUG=webrtc:6424
Review-Url: https://codereview.webrtc.org/2747373003
Cr-Commit-Position: refs/heads/master@{#17364}
diff --git a/webrtc/base/unixfilesystem.cc b/webrtc/base/unixfilesystem.cc
index d0da709..557c478 100644
--- a/webrtc/base/unixfilesystem.cc
+++ b/webrtc/base/unixfilesystem.cc
@@ -204,12 +204,7 @@
LOG(LS_VERBOSE) << "Moving " << old_path.pathname()
<< " to " << new_path.pathname();
if (rename(old_path.pathname().c_str(), new_path.pathname().c_str()) != 0) {
- if (errno != EXDEV)
- return false;
- if (!CopyFile(old_path, new_path))
- return false;
- if (!DeleteFile(old_path))
- return false;
+ return false;
}
return true;
}
@@ -221,31 +216,6 @@
return S_ISDIR(st.st_mode);
}
-bool UnixFilesystem::CopyFile(const Pathname &old_path,
- const Pathname &new_path) {
- LOG(LS_VERBOSE) << "Copying " << old_path.pathname()
- << " to " << new_path.pathname();
- char buf[256];
- size_t len;
-
- StreamInterface *source = OpenFile(old_path, "rb");
- if (!source)
- return false;
-
- StreamInterface *dest = OpenFile(new_path, "wb");
- if (!dest) {
- delete source;
- return false;
- }
-
- while (source->Read(buf, sizeof(buf), &len, nullptr) == SR_SUCCESS)
- dest->Write(buf, len, nullptr, nullptr);
-
- delete source;
- delete dest;
- return true;
-}
-
bool UnixFilesystem::IsTemporaryPath(const Pathname& pathname) {
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_MAC)
RTC_DCHECK(provided_app_temp_folder_ != nullptr);