summaryrefslogtreecommitdiffstats
path: root/tools/ideviceimagemounter.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/ideviceimagemounter.c')
-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)
248 lockdownd_client_free(lckd); 248 lockdownd_client_free(lckd);
249 lckd = NULL; 249 lckd = NULL;
250 250
251 mobile_image_mounter_error_t err; 251 mobile_image_mounter_error_t err = MOBILE_IMAGE_MOUNTER_E_UNKNOWN_ERROR;
252 plist_t result = NULL; 252 plist_t result = NULL;
253 253
254 if (list_mode) { 254 if (list_mode) {
@@ -344,7 +344,7 @@ int main(int argc, char **argv)
344 uint32_t written, total = 0; 344 uint32_t written, total = 0;
345 while (total < amount) { 345 while (total < amount) {
346 written = 0; 346 written = 0;
347 if (afc_file_write(afc, af, buf, amount, &written) != 347 if (afc_file_write(afc, af, buf + total, amount - total, &written) !=
348 AFC_E_SUCCESS) { 348 AFC_E_SUCCESS) {
349 fprintf(stderr, "AFC Write error!\n"); 349 fprintf(stderr, "AFC Write error!\n");
350 break; 350 break;
@@ -368,6 +368,14 @@ int main(int argc, char **argv)
368 368
369 fclose(f); 369 fclose(f);
370 370
371 if (err != MOBILE_IMAGE_MOUNTER_E_SUCCESS) {
372 if (err == MOBILE_IMAGE_MOUNTER_E_DEVICE_LOCKED) {
373 printf("ERROR: Device is locked, can't mount. Unlock device and try again.\n");
374 } else {
375 printf("ERROR: Unknown error occurred, can't mount.\n");
376 }
377 goto error_out;
378 }
371 printf("done.\n"); 379 printf("done.\n");
372 380
373 printf("Mounting...\n"); 381 printf("Mounting...\n");
@@ -435,6 +443,7 @@ int main(int argc, char **argv)
435 plist_free(result); 443 plist_free(result);
436 } 444 }
437 445
446error_out:
438 /* perform hangup command */ 447 /* perform hangup command */
439 mobile_image_mounter_hangup(mim); 448 mobile_image_mounter_hangup(mim);
440 /* free client */ 449 /* free client */