mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-26 04:32:35 +01:00
TAR: Allow to use save_directory with a buffer not 512-bytes aligned
This commit is contained in:
parent
8d662e9327
commit
27becdec97
@ -306,6 +306,8 @@ std::vector<u8> tar_object::save_directory(const std::string& src_dir, std::vect
|
|||||||
{
|
{
|
||||||
fs::file fd(target_path);
|
fs::file fd(target_path);
|
||||||
|
|
||||||
|
const u64 old_size2 = init.size();
|
||||||
|
|
||||||
if (func)
|
if (func)
|
||||||
{
|
{
|
||||||
// Use custom function for file saving if provided
|
// Use custom function for file saving if provided
|
||||||
@ -319,13 +321,12 @@ std::vector<u8> tar_object::save_directory(const std::string& src_dir, std::vect
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const u64 old_size2 = init.size();
|
|
||||||
init.resize(init.size() + stat.size);
|
init.resize(init.size() + stat.size);
|
||||||
ensure(fd.read(init.data() + old_size2, stat.size) == stat.size);
|
ensure(fd.read(init.data() + old_size2, stat.size) == stat.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Align
|
// Align
|
||||||
init.resize(utils::align(init.size(), 512));
|
init.resize(old_size2 + utils::align(init.size() - old_size2, 512));
|
||||||
|
|
||||||
fd.close();
|
fd.close();
|
||||||
fs::utime(target_path, stat.atime, stat.mtime);
|
fs::utime(target_path, stat.atime, stat.mtime);
|
||||||
|
Loading…
Reference in New Issue
Block a user