android: ensure image round down to at least 1 block

Signed-off-by: hmz007 <hmz007@gmail.com>
master
hmz007 9 months ago
parent d89ac7e6e9
commit aa6d0c92fa

@ -465,8 +465,9 @@ void RoundDownPartitions(const ImageConfig& config) {
if (part.path.empty()) {
continue;
}
const auto size = std::max<size_t>(utils::FileSize(part.path), kBlockSize);
auto size = utils::FileSize(part.path);
if (size % kBlockSize != 0) {
size = std::max<size_t>(size, kBlockSize);
const auto err =
truncate(part.path.c_str(), size / kBlockSize * kBlockSize);
CHECK_EQ(err, 0) << "Failed to truncate " << part.path << ", error "

Loading…
Cancel
Save