diff options
| -rw-r--r-- | src/restore.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/restore.c b/src/restore.c index ab14c28..fd23d85 100644 --- a/src/restore.c +++ b/src/restore.c | |||
| @@ -103,6 +103,7 @@ restored_error_t restored_client_free(restored_client_t client) | |||
| 103 | { | 103 | { |
| 104 | if (!client) | 104 | if (!client) |
| 105 | return RESTORE_E_INVALID_ARG; | 105 | return RESTORE_E_INVALID_ARG; |
| 106 | |||
| 106 | restored_error_t ret = RESTORE_E_UNKNOWN_ERROR; | 107 | restored_error_t ret = RESTORE_E_UNKNOWN_ERROR; |
| 107 | 108 | ||
| 108 | if (client->parent) { | 109 | if (client->parent) { |
| @@ -238,22 +239,29 @@ restored_error_t restored_query_type(restored_client_t client, char **type, uint | |||
| 238 | client->info = dict; | 239 | client->info = dict; |
| 239 | 240 | ||
| 240 | /* return the type if requested */ | 241 | /* return the type if requested */ |
| 241 | if (type != NULL) { | 242 | if (type) { |
| 242 | plist_t type_node = plist_dict_get_item(dict, "Type"); | 243 | plist_t type_node = plist_dict_get_item(dict, "Type"); |
| 243 | plist_get_string_val(type_node, type); | 244 | if (type_node && PLIST_STRING == plist_get_node_type(type_node)) { |
| 245 | plist_get_string_val(type_node, type); | ||
| 246 | debug_info("success with type %s", *type); | ||
| 247 | ret = RESTORE_E_SUCCESS; | ||
| 248 | } else { | ||
| 249 | return RESTORE_E_UNKNOWN_ERROR; | ||
| 250 | } | ||
| 244 | } | 251 | } |
| 245 | debug_info("success with type %s", *type); | ||
| 246 | ret = RESTORE_E_SUCCESS; | ||
| 247 | 252 | ||
| 248 | /* fetch the restore protocol version */ | 253 | /* fetch the restore protocol version */ |
| 249 | plist_t version_node = plist_dict_get_item(dict, "RestoreProtocolVersion"); | 254 | if (version) { |
| 250 | if (version_node && version) { | 255 | plist_t version_node = plist_dict_get_item(dict, "RestoreProtocolVersion"); |
| 251 | plist_get_uint_val(version_node, version); | 256 | if (version_node && PLIST_UINT == plist_get_node_type(version_node)) { |
| 252 | debug_info("restored protocol version %llu", *version); | 257 | plist_get_uint_val(version_node, version); |
| 253 | ret = RESTORE_E_SUCCESS; | 258 | debug_info("restored protocol version %llu", *version); |
| 254 | } else | 259 | ret = RESTORE_E_SUCCESS; |
| 255 | ret = RESTORE_E_UNKNOWN_ERROR; | 260 | } else { |
| 256 | 261 | return RESTORE_E_UNKNOWN_ERROR; | |
| 262 | } | ||
| 263 | } | ||
| 264 | ret = RESTORE_E_SUCCESS; | ||
| 257 | } | 265 | } |
| 258 | 266 | ||
| 259 | return ret; | 267 | return ret; |
