diff options
Diffstat (limited to 'src')
| -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 | |||
| 232 | return ret; | 232 | return ret; |
| 233 | 233 | ||
| 234 | ret = RESTORE_E_UNKNOWN_ERROR; | 234 | ret = RESTORE_E_UNKNOWN_ERROR; |
| 235 | if (restored_check_result(dict) == RESULT_SUCCESS) { | 235 | plist_t type_node = plist_dict_get_item(dict, "Type"); |
| 236 | if (type_node && (plist_get_node_type(type_node) == PLIST_STRING)) { | ||
| 237 | char* typestr = NULL; | ||
| 238 | |||
| 236 | /* save our device information info */ | 239 | /* save our device information info */ |
| 237 | client->info = dict; | 240 | client->info = dict; |
| 238 | 241 | ||
| 242 | plist_get_string_val(type_node, &typestr); | ||
| 243 | debug_info("success with type %s", typestr); | ||
| 239 | /* return the type if requested */ | 244 | /* return the type if requested */ |
| 240 | if (type) { | 245 | if (type) { |
| 241 | plist_t type_node = plist_dict_get_item(dict, "Type"); | 246 | *type = typestr; |
| 242 | if (type_node && PLIST_STRING == plist_get_node_type(type_node)) { | 247 | } else { |
| 243 | plist_get_string_val(type_node, type); | 248 | free(typestr); |
| 244 | debug_info("success with type %s", *type); | ||
| 245 | ret = RESTORE_E_SUCCESS; | ||
| 246 | } else { | ||
| 247 | return RESTORE_E_UNKNOWN_ERROR; | ||
| 248 | } | ||
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | /* fetch the restore protocol version */ | 251 | /* fetch the restore protocol version */ |
| @@ -254,12 +254,15 @@ restored_error_t restored_query_type(restored_client_t client, char **type, uint | |||
| 254 | if (version_node && PLIST_UINT == plist_get_node_type(version_node)) { | 254 | if (version_node && PLIST_UINT == plist_get_node_type(version_node)) { |
| 255 | plist_get_uint_val(version_node, version); | 255 | plist_get_uint_val(version_node, version); |
| 256 | debug_info("restored protocol version %llu", *version); | 256 | debug_info("restored protocol version %llu", *version); |
| 257 | ret = RESTORE_E_SUCCESS; | ||
| 258 | } else { | 257 | } else { |
| 259 | return RESTORE_E_UNKNOWN_ERROR; | 258 | return RESTORE_E_UNKNOWN_ERROR; |
| 260 | } | 259 | } |
| 261 | } | 260 | } |
| 262 | ret = RESTORE_E_SUCCESS; | 261 | ret = RESTORE_E_SUCCESS; |
| 262 | } else { | ||
| 263 | debug_info("hmm. QueryType response does not contain a type?!\n"); | ||
| 264 | debug_plist(dict); | ||
| 265 | plist_free(dict); | ||
| 263 | } | 266 | } |
| 264 | 267 | ||
| 265 | return ret; | 268 | return ret; |
