summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-09-27 20:44:03 +0200
committerGravatar Nikias Bassen2019-09-27 20:44:03 +0200
commit92d95d0b8f1870d7cc9eb809a993b04b0e733205 (patch)
treefa8c3015b42d4ca8d83c9231d4b48c047d6a84d2 /tools
parent1faa16c912dd5eb4e9305b25b13407de195ad103 (diff)
downloadlibimobiledevice-92d95d0b8f1870d7cc9eb809a993b04b0e733205.tar.gz
libimobiledevice-92d95d0b8f1870d7cc9eb809a993b04b0e733205.tar.bz2
mobile_image_mounter: Better error handling (e.g. when device is locked)
Diffstat (limited to 'tools')
-rw-r--r--tools/ideviceimagemounter.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c
index 7101c7e..93cab09 100644
--- a/tools/ideviceimagemounter.c
+++ b/tools/ideviceimagemounter.c
@@ -248,7 +248,7 @@ int main(int argc, char **argv)
lockdownd_client_free(lckd);
lckd = NULL;
- mobile_image_mounter_error_t err;
+ mobile_image_mounter_error_t err = MOBILE_IMAGE_MOUNTER_E_UNKNOWN_ERROR;
plist_t result = NULL;
if (list_mode) {
@@ -344,7 +344,7 @@ int main(int argc, char **argv)
uint32_t written, total = 0;
while (total < amount) {
written = 0;
- if (afc_file_write(afc, af, buf, amount, &written) !=
+ if (afc_file_write(afc, af, buf + total, amount - total, &written) !=
AFC_E_SUCCESS) {
fprintf(stderr, "AFC Write error!\n");
break;
@@ -368,6 +368,14 @@ int main(int argc, char **argv)
fclose(f);
+ if (err != MOBILE_IMAGE_MOUNTER_E_SUCCESS) {
+ if (err == MOBILE_IMAGE_MOUNTER_E_DEVICE_LOCKED) {
+ printf("ERROR: Device is locked, can't mount. Unlock device and try again.\n");
+ } else {
+ printf("ERROR: Unknown error occurred, can't mount.\n");
+ }
+ goto error_out;
+ }
printf("done.\n");
printf("Mounting...\n");
@@ -435,6 +443,7 @@ int main(int argc, char **argv)
plist_free(result);
}
+error_out:
/* perform hangup command */
mobile_image_mounter_hangup(mim);
/* free client */