diff options
Diffstat (limited to 'src/restore.c')
-rw-r--r-- | src/restore.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/restore.c b/src/restore.c index 85009e4..a7f07f2 100644 --- a/src/restore.c +++ b/src/restore.c @@ -232,20 +232,20 @@ restored_error_t restored_query_type(restored_client_t client, char **type, uint return ret; ret = RESTORE_E_UNKNOWN_ERROR; - if (restored_check_result(dict) == RESULT_SUCCESS) { + plist_t type_node = plist_dict_get_item(dict, "Type"); + if (type_node && (plist_get_node_type(type_node) == PLIST_STRING)) { + char* typestr = NULL; + /* save our device information info */ client->info = dict; - + + plist_get_string_val(type_node, &typestr); + debug_info("success with type %s", typestr); /* return the type if requested */ if (type) { - plist_t type_node = plist_dict_get_item(dict, "Type"); - if (type_node && PLIST_STRING == plist_get_node_type(type_node)) { - plist_get_string_val(type_node, type); - debug_info("success with type %s", *type); - ret = RESTORE_E_SUCCESS; - } else { - return RESTORE_E_UNKNOWN_ERROR; - } + *type = typestr; + } else { + free(typestr); } /* fetch the restore protocol version */ @@ -254,12 +254,15 @@ restored_error_t restored_query_type(restored_client_t client, char **type, uint if (version_node && PLIST_UINT == plist_get_node_type(version_node)) { plist_get_uint_val(version_node, version); debug_info("restored protocol version %llu", *version); - ret = RESTORE_E_SUCCESS; } else { return RESTORE_E_UNKNOWN_ERROR; } } ret = RESTORE_E_SUCCESS; + } else { + debug_info("hmm. QueryType response does not contain a type?!\n"); + debug_plist(dict); + plist_free(dict); } return ret; |