mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-10-03 23:38:25 +00:00
Always handle return codes from recurse_manifest()
There were a few places in the code that needed to check for errors returned by recurse_manifest(). Notably, if remove_bundles() failed to load the full set of manifests for installed bundles, bundle-remove may have removed more files than it should, due to the lack of context provided by the other bundle manifests. Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
This commit is contained in:
+17
-2
@@ -281,13 +281,21 @@ int remove_bundle(const char *bundle_name)
|
||||
}
|
||||
|
||||
subscription_versions_from_MoM(current_mom, 0);
|
||||
|
||||
/* load all submanifest minus the one to be removed */
|
||||
recurse_manifest(current_mom, NULL);
|
||||
ret = recurse_manifest(current_mom, NULL);
|
||||
if (ret != 0) {
|
||||
printf("Error: Cannot load MoM sub-manifests (ret = %d)\n", ret);
|
||||
ret = ERECURSE_MANIFEST;
|
||||
goto out_free_mom;
|
||||
}
|
||||
|
||||
consolidate_submanifests(current_mom);
|
||||
|
||||
/* Now that we have the consolidated list of all files, load bundle to be removed submanifest*/
|
||||
ret = load_bundle_manifest(bundle_name, current_version, &bundle_manifest);
|
||||
if (ret != 0) {
|
||||
printf("Error: Cannot load %s sub-manifest (ret = %d)\n", bundle_name, ret);
|
||||
goto out_free_mom;
|
||||
}
|
||||
|
||||
@@ -412,7 +420,14 @@ int install_bundles(struct list *bundles, int current_version, struct manifest *
|
||||
}
|
||||
|
||||
subscription_versions_from_MoM(mom, 0);
|
||||
recurse_manifest(mom, NULL);
|
||||
|
||||
ret = recurse_manifest(mom, NULL);
|
||||
if (ret != 0) {
|
||||
printf("Error: Cannot load MoM sub-manifests (ret = %d)\n", ret);
|
||||
ret = ERECURSE_MANIFEST;
|
||||
goto out;
|
||||
}
|
||||
|
||||
consolidate_submanifests(mom);
|
||||
|
||||
/* step 2: download neccessary packs */
|
||||
|
||||
+8
-1
@@ -650,7 +650,14 @@ int verify_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
subscription_versions_from_MoM(official_manifest, 0);
|
||||
recurse_manifest(official_manifest, NULL);
|
||||
|
||||
ret = recurse_manifest(official_manifest, NULL);
|
||||
if (ret != 0) {
|
||||
printf("Error: Cannot load MoM sub-manifests (ret = %d)\n", ret);
|
||||
ret = ERECURSE_MANIFEST;
|
||||
goto clean_and_exit;
|
||||
}
|
||||
|
||||
consolidate_submanifests(official_manifest);
|
||||
|
||||
/* preparation work complete. */
|
||||
|
||||
Reference in New Issue
Block a user