Prune orphaned rename files from manifest

When renamed-to files are deleted or are renamed again, the original
renamed-from file is orphaned as it has no renamed-to peer. Prune these
from the manifests by checking if the rename_peer field is NULL.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
This commit is contained in:
Matthew Johnson
2017-11-21 14:03:45 -08:00
parent b0c4a1c24e
commit 83a9c39556
+8
View File
@@ -1045,6 +1045,14 @@ int prune_manifest(struct manifest *manifest)
next = g_list_next(list);
file = list->data;
/* if the file is marked as deleted and renamed it is a renamed_from
* file. If the rename_peer field is still NULL then it has been
* orphaned. Prune these files */
if (file->is_deleted && file->is_rename && !file->rename_peer) {
manifest->files = g_list_delete_link(manifest->files, list);
manifest->count--;
}
if (OS_IS_STATELESS && (!file->is_deleted) && (file->is_config)) {
// toward being a stateless OS
LOG(file, "Skipping config file in manifest write", "component %s", manifest->component);