summaryrefslogtreecommitdiffstats
path: root/src/restore.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2020-04-12 23:28:58 +0200
committerGravatar Nikias Bassen2020-04-12 23:28:58 +0200
commitf27d19e1c2e69dba271834d0c7a3a5be3a83e275 (patch)
treedf46795ef68fa1661316ea277cade91a4d3ef6fd /src/restore.c
parent513950377df9cb93747ac69dae4ab55dded3ac5c (diff)
downloadidevicerestore-f27d19e1c2e69dba271834d0c7a3a5be3a83e275.tar.gz
idevicerestore-f27d19e1c2e69dba271834d0c7a3a5be3a83e275.tar.bz2
restore: Don't fail when Rap,RestoreRTKitOS entry is missing from build identity
Diffstat (limited to 'src/restore.c')
-rw-r--r--src/restore.c68
1 files changed, 36 insertions, 32 deletions
diff --git a/src/restore.c b/src/restore.c
index 7a4e4fb..5763fcf 100644
--- a/src/restore.c
+++ b/src/restore.c
@@ -2269,46 +2269,50 @@ plist_t restore_get_rose_firmware_data(restored_client_t restore, struct idevice
component_data = NULL;
component_size = 0;
if (ftag != 'rkos') {
- error("WARNING: Unexpected tag 0x%08x, expected 0x%08x; continuing anyway.", ftag, 'rkos');
+ error("WARNING: Unexpected tag 0x%08x, expected 0x%08x; continuing anyway.\n", ftag, 'rkos');
}
comp_name = "Rap,RestoreRTKitOS";
- if (build_identity_get_component_path(build_identity, comp_name, &comp_path) < 0) {
- ftab_free(ftab);
- error("ERROR: Unable get path for '%s' component\n", comp_name);
- return NULL;
- }
- ret = extract_component(client->ipsw, comp_path, &component_data, &component_size);
- free(comp_path);
- comp_path = NULL;
- if (ret < 0) {
- ftab_free(ftab);
- error("ERROR: Unable to extract '%s' component\n", comp_name);
- return NULL;
- }
+ if (build_identity_has_component(build_identity, comp_name)) {
+ if (build_identity_get_component_path(build_identity, comp_name, &comp_path) < 0) {
+ ftab_free(ftab);
+ error("ERROR: Unable get path for '%s' component\n", comp_name);
+ return NULL;
+ }
+ ret = extract_component(client->ipsw, comp_path, &component_data, &component_size);
+ free(comp_path);
+ comp_path = NULL;
+ if (ret < 0) {
+ ftab_free(ftab);
+ error("ERROR: Unable to extract '%s' component\n", comp_name);
+ return NULL;
+ }
- ftag = 0;
- if (ftab_parse(component_data, component_size, &rftab, &ftag) != 0) {
+ ftag = 0;
+ if (ftab_parse(component_data, component_size, &rftab, &ftag) != 0) {
+ free(component_data);
+ ftab_free(ftab);
+ error("ERROR: Failed to parse '%s' component data.\n");
+ return NULL;
+ }
free(component_data);
- ftab_free(ftab);
- error("ERROR: Failed to parse '%s' component data.\n");
- return NULL;
- }
- free(component_data);
- component_data = NULL;
- component_size = 0;
- if (ftag != 'rkos') {
- error("WARNING: Unexpected tag 0x%08x, expected 0x%08x; continuing anyway.", ftag, 'rkos');
- }
+ component_data = NULL;
+ component_size = 0;
+ if (ftag != 'rkos') {
+ error("WARNING: Unexpected tag 0x%08x, expected 0x%08x; continuing anyway.\n", ftag, 'rkos');
+ }
- if (ftab_get_entry_ptr(rftab, 'rrko', &component_data, &component_size) == 0) {
- ftab_add_entry(ftab, 'rrko', component_data, component_size);
+ if (ftab_get_entry_ptr(rftab, 'rrko', &component_data, &component_size) == 0) {
+ ftab_add_entry(ftab, 'rrko', component_data, component_size);
+ } else {
+ error("ERROR: Could not find 'rrko' entry in ftab. This will probably break things.\n");
+ }
+ ftab_free(rftab);
+ component_data = NULL;
+ component_size = 0;
} else {
- error("ERROR: Could not find 'rrko' entry in ftab. This will probably break things.\n");
+ info("NOTE: Build identity does not have a '%s' component.\n", comp_name);
}
- ftab_free(rftab);
- component_data = NULL;
- component_size = 0;
ftab_write(ftab, &component_data, &component_size);
ftab_free(ftab);