summaryrefslogtreecommitdiffstats
path: root/tools/idevicebackup.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/idevicebackup.c')
-rw-r--r--tools/idevicebackup.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c
index b3b073a..58301f5 100644
--- a/tools/idevicebackup.c
+++ b/tools/idevicebackup.c
@@ -536,12 +536,14 @@ int main(int argc, char *argv[])
536 printf("ERROR: Could not start service %s.\n", NP_SERVICE_NAME); 536 printf("ERROR: Could not start service %s.\n", NP_SERVICE_NAME);
537 } 537 }
538 538
539 /* start AFC, we need this for the lock file */
540 afc_client_t afc = NULL; 539 afc_client_t afc = NULL;
541 port = 0; 540 if (cmd == CMD_BACKUP) {
542 ret = lockdownd_start_service(client, "com.apple.afc", &port); 541 /* start AFC, we need this for the lock file */
543 if ((ret == LOCKDOWN_E_SUCCESS) && port) { 542 port = 0;
544 afc_client_new(phone, port, &afc); 543 ret = lockdownd_start_service(client, "com.apple.afc", &port);
544 if ((ret == LOCKDOWN_E_SUCCESS) && port) {
545 afc_client_new(phone, port, &afc);
546 }
545 } 547 }
546 548
547 /* start mobilebackup service and retrieve port */ 549 /* start mobilebackup service and retrieve port */
@@ -581,9 +583,11 @@ int main(int argc, char *argv[])
581 is_full_backup = 1; 583 is_full_backup = 1;
582 } 584 }
583 585
584 do_post_notification(NP_SYNC_WILL_START);
585 uint64_t lockfile = 0; 586 uint64_t lockfile = 0;
586 afc_file_open(afc, "/com.apple.itunes.lock_sync", AFC_FOPEN_RW, &lockfile); 587 if (cmd == CMD_BACKUP) {
588 do_post_notification(NP_SYNC_WILL_START);
589 afc_file_open(afc, "/com.apple.itunes.lock_sync", AFC_FOPEN_RW, &lockfile);
590 }
587 if (lockfile) { 591 if (lockfile) {
588 do_post_notification(NP_SYNC_LOCK_REQUEST); 592 do_post_notification(NP_SYNC_LOCK_REQUEST);
589 if (afc_file_lock(afc, lockfile, AFC_LOCK_EX) == AFC_E_SUCCESS) { 593 if (afc_file_lock(afc, lockfile, AFC_LOCK_EX) == AFC_E_SUCCESS) {