diff options
| author | 2018-10-24 00:01:29 -0400 | |
|---|---|---|
| committer | 2018-10-24 00:01:32 -0400 | |
| commit | c7c594a6b8416a68f40c7c141c58727e33c05b0a (patch) | |
| tree | 518aec46ee28be5ae6ce2321e3ca9bf8f56a4e37 /src/core/file_sys/vfs.cpp | |
| parent | key_manager: Remove unused variable in DeriveBase() (diff) | |
| download | yuzu-c7c594a6b8416a68f40c7c141c58727e33c05b0a.tar.gz yuzu-c7c594a6b8416a68f40c7c141c58727e33c05b0a.tar.xz yuzu-c7c594a6b8416a68f40c7c141c58727e33c05b0a.zip | |
vfs: Handle failure of file reading within VfsRawCopy()
Also gets rid of an unused variable.
Diffstat (limited to 'src/core/file_sys/vfs.cpp')
| -rw-r--r-- | src/core/file_sys/vfs.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/file_sys/vfs.cpp b/src/core/file_sys/vfs.cpp index bfe50da73..3824c74e0 100644 --- a/src/core/file_sys/vfs.cpp +++ b/src/core/file_sys/vfs.cpp | |||
| @@ -472,10 +472,14 @@ bool VfsRawCopy(const VirtualFile& src, const VirtualFile& dest, std::size_t blo | |||
| 472 | std::vector<u8> temp(std::min(block_size, src->GetSize())); | 472 | std::vector<u8> temp(std::min(block_size, src->GetSize())); |
| 473 | for (std::size_t i = 0; i < src->GetSize(); i += block_size) { | 473 | for (std::size_t i = 0; i < src->GetSize(); i += block_size) { |
| 474 | const auto read = std::min(block_size, src->GetSize() - i); | 474 | const auto read = std::min(block_size, src->GetSize() - i); |
| 475 | const auto block = src->Read(temp.data(), read, i); | ||
| 476 | 475 | ||
| 477 | if (dest->Write(temp.data(), read, i) != read) | 476 | if (src->Read(temp.data(), read, i) != read) { |
| 478 | return false; | 477 | return false; |
| 478 | } | ||
| 479 | |||
| 480 | if (dest->Write(temp.data(), read, i) != read) { | ||
| 481 | return false; | ||
| 482 | } | ||
| 479 | } | 483 | } |
| 480 | 484 | ||
| 481 | return true; | 485 | return true; |