summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/idevicebackup2.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c
index b850329..1b8d758 100644
--- a/tools/idevicebackup2.c
+++ b/tools/idevicebackup2.c
@@ -1285,6 +1285,7 @@ int main(int argc, char *argv[])
1285 int cmd = -1; 1285 int cmd = -1;
1286 int cmd_flags = 0; 1286 int cmd_flags = 0;
1287 int is_full_backup = 0; 1287 int is_full_backup = 0;
1288 int result_code = -1;
1288 char* backup_directory = NULL; 1289 char* backup_directory = NULL;
1289 char* backup_password = NULL; 1290 char* backup_password = NULL;
1290 char* newpw = NULL; 1291 char* newpw = NULL;
@@ -2075,6 +2076,9 @@ checkpoint:
2075 error_code = (uint32_t)ec; 2076 error_code = (uint32_t)ec;
2076 if (error_code == 0) { 2077 if (error_code == 0) {
2077 operation_ok = 1; 2078 operation_ok = 1;
2079 result_code = 0;
2080 } else {
2081 result_code = -error_code;
2078 } 2082 }
2079 } 2083 }
2080 nn = plist_dict_get_item(node_tmp, "ErrorDescription"); 2084 nn = plist_dict_get_item(node_tmp, "ErrorDescription");
@@ -2132,13 +2136,13 @@ files_out:
2132 switch (cmd) { 2136 switch (cmd) {
2133 case CMD_BACKUP: 2137 case CMD_BACKUP:
2134 PRINT_VERBOSE(1, "Received %d files from device.\n", file_count); 2138 PRINT_VERBOSE(1, "Received %d files from device.\n", file_count);
2135 if (mb2_status_check_snapshot_state(backup_directory, udid, "finished")) { 2139 if (operation_ok && mb2_status_check_snapshot_state(backup_directory, udid, "finished")) {
2136 PRINT_VERBOSE(1, "Backup Successful.\n"); 2140 PRINT_VERBOSE(1, "Backup Successful.\n");
2137 } else { 2141 } else {
2138 if (quit_flag) { 2142 if (quit_flag) {
2139 PRINT_VERBOSE(1, "Backup Aborted.\n"); 2143 PRINT_VERBOSE(1, "Backup Aborted.\n");
2140 } else { 2144 } else {
2141 PRINT_VERBOSE(1, "Backup Failed.\n"); 2145 PRINT_VERBOSE(1, "Backup Failed (Error Code %d).\n", -result_code);
2142 } 2146 }
2143 } 2147 }
2144 break; 2148 break;
@@ -2177,7 +2181,7 @@ files_out:
2177 if (operation_ok) { 2181 if (operation_ok) {
2178 PRINT_VERBOSE(1, "Restore Successful.\n"); 2182 PRINT_VERBOSE(1, "Restore Successful.\n");
2179 } else { 2183 } else {
2180 PRINT_VERBOSE(1, "Restore Failed.\n"); 2184 PRINT_VERBOSE(1, "Restore Failed (Error Code %d).\n", -result_code);
2181 } 2185 }
2182 2186
2183 break; 2187 break;
@@ -2231,6 +2235,6 @@ files_out:
2231 free(source_udid); 2235 free(source_udid);
2232 } 2236 }
2233 2237
2234 return 0; 2238 return result_code;
2235} 2239}
2236 2240