From 007a3d295ebe340617e2f6db8498c17a379f8eea Mon Sep 17 00:00:00 2001 From: hedger Date: Thu, 15 Sep 2022 17:55:55 +0400 Subject: [PATCH] [FL-2819] updater: fixed failing backups on /int with empty files in it #1735 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: あく --- lib/toolbox/tar/tar_archive.c | 1 + lib/update_util/lfs_backup.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/toolbox/tar/tar_archive.c b/lib/toolbox/tar/tar_archive.c index 5ac89a0f..0d42d162 100644 --- a/lib/toolbox/tar/tar_archive.c +++ b/lib/toolbox/tar/tar_archive.c @@ -294,6 +294,7 @@ bool tar_archive_add_file( break; } + success = true; // if file is empty, that's not an error uint16_t bytes_read = 0; 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); diff --git a/lib/update_util/lfs_backup.c b/lib/update_util/lfs_backup.c index b4a0aaab..089f032d 100644 --- a/lib/update_util/lfs_backup.c +++ b/lib/update_util/lfs_backup.c @@ -42,8 +42,7 @@ bool lfs_backup_create(Storage* storage, const char* destination) { bool lfs_backup_exists(Storage* storage, const char* source) { const char* final_source = source && strlen(source) ? source : LFS_BACKUP_DEFAULT_LOCATION; - FileInfo fi; - return storage_common_stat(storage, final_source, &fi) == FSE_OK; + return storage_common_stat(storage, final_source, NULL) == FSE_OK; } bool lfs_backup_unpack(Storage* storage, const char* source) {