[FL-2819] updater: fixed failing backups on /int with empty files in it #1735

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
hedger 2022-09-15 17:55:55 +04:00 committed by GitHub
parent 28beff1ab6
commit 007a3d295e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -294,6 +294,7 @@ bool tar_archive_add_file(
break; break;
} }
success = true; // if file is empty, that's not an error
uint16_t bytes_read = 0; uint16_t bytes_read = 0;
while((bytes_read = storage_file_read(src_file, file_buffer, FILE_BLOCK_SIZE))) { while((bytes_read = storage_file_read(src_file, file_buffer, FILE_BLOCK_SIZE))) {
success = tar_archive_file_add_data_block(archive, file_buffer, bytes_read); success = tar_archive_file_add_data_block(archive, file_buffer, bytes_read);

View File

@ -42,8 +42,7 @@ bool lfs_backup_create(Storage* storage, const char* destination) {
bool lfs_backup_exists(Storage* storage, const char* source) { bool lfs_backup_exists(Storage* storage, const char* source) {
const char* final_source = source && strlen(source) ? source : LFS_BACKUP_DEFAULT_LOCATION; const char* final_source = source && strlen(source) ? source : LFS_BACKUP_DEFAULT_LOCATION;
FileInfo fi; return storage_common_stat(storage, final_source, NULL) == FSE_OK;
return storage_common_stat(storage, final_source, &fi) == FSE_OK;
} }
bool lfs_backup_unpack(Storage* storage, const char* source) { bool lfs_backup_unpack(Storage* storage, const char* source) {