summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-06-21 21:31:21 +0200
committerGravatar Nikias Bassen2019-06-21 21:31:21 +0200
commit1d4ac48da49809e3c38574b711697cbb2ee0d773 (patch)
tree36888eb03c56731c036c2ab79dc519a811cbb870 /tools
parentaa014c43a7dccd519c0c89605711906b30b98888 (diff)
downloadlibimobiledevice-1d4ac48da49809e3c38574b711697cbb2ee0d773.tar.gz
libimobiledevice-1d4ac48da49809e3c38574b711697cbb2ee0d773.tar.bz2
idevicebackup2: Handle errors when receiving files and report back to device
Diffstat (limited to 'tools')
-rw-r--r--tools/idevicebackup2.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c
index 1e6ddf7..0aae36e 100644
--- a/tools/idevicebackup2.c
+++ b/tools/idevicebackup2.c
@@ -1004,6 +1004,8 @@ static int mb2_handle_receive_files(mobilebackup2_client_t mobilebackup2, plist_
plist_t node = NULL;
FILE *f = NULL;
unsigned int file_count = 0;
+ int errcode = 0;
+ char *errdesc = NULL;
if (!message || (plist_get_node_type(message) != PLIST_ARRAY) || plist_array_get_size(message) < 4 || !backup_dir) return 0;
@@ -1105,7 +1107,10 @@ static int mb2_handle_receive_files(mobilebackup2_client_t mobilebackup2, plist_
fclose(f);
file_count++;
} else {
- printf("Error opening '%s' for writing: %s\n", bname, strerror(errno));
+ errcode = errno_to_device_error(errno);
+ errdesc = strerror(errno);
+ printf("Error opening '%s' for writing: %s\n", bname, errdesc);
+ break;
}
if (nlen == 0) {
break;
@@ -1144,9 +1149,8 @@ static int mb2_handle_receive_files(mobilebackup2_client_t mobilebackup2, plist_
if (dname != NULL)
free(dname);
- // TODO error handling?!
plist_t empty_plist = plist_new_dict();
- mobilebackup2_send_status_response(mobilebackup2, 0, NULL, empty_plist);
+ mobilebackup2_send_status_response(mobilebackup2, errcode, errdesc, empty_plist);
plist_free(empty_plist);
return file_count;