diff options
| -rw-r--r-- | tools/idevicebackup2.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index 0ab434e..6ed852f 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c | |||
| @@ -1479,7 +1479,14 @@ int main(int argc, char *argv[]) | |||
| 1479 | plist_t node_tmp = NULL; | 1479 | plist_t node_tmp = NULL; |
| 1480 | plist_t info_plist = NULL; | 1480 | plist_t info_plist = NULL; |
| 1481 | plist_t opts = NULL; | 1481 | plist_t opts = NULL; |
| 1482 | |||
| 1483 | idevice_t device = NULL; | ||
| 1484 | afc_client_t afc = NULL; | ||
| 1485 | np_client_t np = NULL; | ||
| 1486 | lockdownd_client_t lockdown = NULL; | ||
| 1487 | mobilebackup2_client_t mobilebackup2 = NULL; | ||
| 1482 | mobilebackup2_error_t err; | 1488 | mobilebackup2_error_t err; |
| 1489 | uint64_t lockfile = 0; | ||
| 1483 | 1490 | ||
| 1484 | /* we need to exit cleanly on running backups and restores or we cause havok */ | 1491 | /* we need to exit cleanly on running backups and restores or we cause havok */ |
| 1485 | signal(SIGINT, clean_exit); | 1492 | signal(SIGINT, clean_exit); |
| @@ -1689,7 +1696,6 @@ int main(int argc, char *argv[]) | |||
| 1689 | } | 1696 | } |
| 1690 | } | 1697 | } |
| 1691 | 1698 | ||
| 1692 | idevice_t device = NULL; | ||
| 1693 | ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX); | 1699 | ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX); |
| 1694 | if (ret != IDEVICE_E_SUCCESS) { | 1700 | if (ret != IDEVICE_E_SUCCESS) { |
| 1695 | if (udid) { | 1701 | if (udid) { |
| @@ -1770,7 +1776,6 @@ int main(int argc, char *argv[]) | |||
| 1770 | } | 1776 | } |
| 1771 | } | 1777 | } |
| 1772 | 1778 | ||
| 1773 | lockdownd_client_t lockdown = NULL; | ||
| 1774 | if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lockdown, TOOL_NAME))) { | 1779 | if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lockdown, TOOL_NAME))) { |
| 1775 | printf("ERROR: Could not connect to lockdownd, error code %d\n", ldret); | 1780 | printf("ERROR: Could not connect to lockdownd, error code %d\n", ldret); |
| 1776 | idevice_free(device); | 1781 | idevice_free(device); |
| @@ -1808,7 +1813,6 @@ int main(int argc, char *argv[]) | |||
| 1808 | } | 1813 | } |
| 1809 | 1814 | ||
| 1810 | /* start notification_proxy */ | 1815 | /* start notification_proxy */ |
| 1811 | np_client_t np = NULL; | ||
| 1812 | ldret = lockdownd_start_service(lockdown, NP_SERVICE_NAME, &service); | 1816 | ldret = lockdownd_start_service(lockdown, NP_SERVICE_NAME, &service); |
| 1813 | if ((ldret == LOCKDOWN_E_SUCCESS) && service && service->port) { | 1817 | if ((ldret == LOCKDOWN_E_SUCCESS) && service && service->port) { |
| 1814 | np_client_new(device, service, &np); | 1818 | np_client_new(device, service, &np); |
| @@ -1831,7 +1835,6 @@ int main(int argc, char *argv[]) | |||
| 1831 | service = NULL; | 1835 | service = NULL; |
| 1832 | } | 1836 | } |
| 1833 | 1837 | ||
| 1834 | afc_client_t afc = NULL; | ||
| 1835 | if (cmd == CMD_BACKUP || cmd == CMD_RESTORE) { | 1838 | if (cmd == CMD_BACKUP || cmd == CMD_RESTORE) { |
| 1836 | /* start AFC, we need this for the lock file */ | 1839 | /* start AFC, we need this for the lock file */ |
| 1837 | ldret = lockdownd_start_service(lockdown, AFC_SERVICE_NAME, &service); | 1840 | ldret = lockdownd_start_service(lockdown, AFC_SERVICE_NAME, &service); |
| @@ -1850,7 +1853,6 @@ int main(int argc, char *argv[]) | |||
| 1850 | } | 1853 | } |
| 1851 | 1854 | ||
| 1852 | /* start mobilebackup service and retrieve port */ | 1855 | /* start mobilebackup service and retrieve port */ |
| 1853 | mobilebackup2_client_t mobilebackup2 = NULL; | ||
| 1854 | ldret = lockdownd_start_service_with_escrow_bag(lockdown, MOBILEBACKUP2_SERVICE_NAME, &service); | 1856 | ldret = lockdownd_start_service_with_escrow_bag(lockdown, MOBILEBACKUP2_SERVICE_NAME, &service); |
| 1855 | lockdownd_client_free(lockdown); | 1857 | lockdownd_client_free(lockdown); |
| 1856 | lockdown = NULL; | 1858 | lockdown = NULL; |
| @@ -1900,7 +1902,6 @@ int main(int argc, char *argv[]) | |||
| 1900 | } | 1902 | } |
| 1901 | } | 1903 | } |
| 1902 | 1904 | ||
| 1903 | uint64_t lockfile = 0; | ||
| 1904 | if (cmd == CMD_BACKUP || cmd == CMD_RESTORE) { | 1905 | if (cmd == CMD_BACKUP || cmd == CMD_RESTORE) { |
| 1905 | do_post_notification(device, NP_SYNC_WILL_START); | 1906 | do_post_notification(device, NP_SYNC_WILL_START); |
| 1906 | afc_file_open(afc, "/com.apple.itunes.lock_sync", AFC_FOPEN_RW, &lockfile); | 1907 | afc_file_open(afc, "/com.apple.itunes.lock_sync", AFC_FOPEN_RW, &lockfile); |
