From 7b14eddad8cf730b0c5dfbdeecbea0c9f7573b0e Mon Sep 17 00:00:00 2001 From: Patrick McCarty Date: Fri, 15 Apr 2016 14:08:08 -0700 Subject: [PATCH] Fix for deleted file accounting With the recent change to swupd-server that removes old deleted files in the initial manifests for a new format, the case in which these files are absent from the new manifest should not be counted as deleted. Also, fix another deleted file accounting issue: the file could have been deleted anywhere in the range current < N <= new, not just at the latest (new) version. Signed-off-by: Patrick McCarty --- src/manifest.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/manifest.c b/src/manifest.c index 50874406..fff339b4 100644 --- a/src/manifest.c +++ b/src/manifest.c @@ -654,14 +654,19 @@ void link_manifests(struct manifest *m1, struct manifest *m2) if (((file2->last_change == m2->version) || (file2->last_change > m1->version)) && !file2->is_deleted) { account_changed_file(); } - if (file2->last_change == m2->version && file2->is_deleted) { + if (file2->last_change > m1->version && file2->is_deleted) { account_deleted_file(); } continue; } if (ret < 0) { /* m1/file1 is before m2/file2 */ + /* File is absent in m2, indicating that a format bump + * happened, removing deleted file entries from the + * previous format(s). Do not account the deleted file + * in this case, since an update will not delete the + * file. + */ list1 = list1->next; - account_deleted_file(); continue; } /* else ret > 0 m1/file1 is after m2/file2 */ list2 = list2->next;