diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/idevicebackup.c | 11 | ||||
-rw-r--r-- | tools/idevicebackup2.c | 11 | ||||
-rw-r--r-- | tools/idevicedebugserverproxy.c | 2 | ||||
-rw-r--r-- | tools/idevicediagnostics.c | 2 | ||||
-rw-r--r-- | tools/ideviceimagemounter.c | 4 | ||||
-rw-r--r-- | tools/idevicescreenshot.c | 2 |
6 files changed, 11 insertions, 21 deletions
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c index 95c5694..8f5362c 100644 --- a/tools/idevicebackup.c +++ b/tools/idevicebackup.c @@ -755,7 +755,7 @@ static void do_post_notification(const char *notification) } lockdownd_start_service(client, NP_SERVICE_NAME, &service); - if (service->port) { + if (service && service->port) { np_client_new(device, service, &np); if (np) { np_post_notification(np, notification); @@ -937,7 +937,7 @@ int main(int argc, char *argv[]) /* start notification_proxy */ np_client_t np = NULL; ret = lockdownd_start_service(client, NP_SERVICE_NAME, &service); - if ((ret == LOCKDOWN_E_SUCCESS) && service->port) { + if ((ret == LOCKDOWN_E_SUCCESS) && service && service->port) { np_client_new(device, service, &np); np_set_notify_callback(np, notify_cb, NULL); const char *noties[5] = { @@ -952,11 +952,6 @@ int main(int argc, char *argv[]) printf("ERROR: Could not start service %s.\n", NP_SERVICE_NAME); } - if (service) { - lockdownd_service_descriptor_free(service); - service = NULL; - } - afc_client_t afc = NULL; if (cmd == CMD_BACKUP) { /* start AFC, we need this for the lock file */ @@ -975,7 +970,7 @@ int main(int argc, char *argv[]) /* start mobilebackup service and retrieve port */ ret = lockdownd_start_service(client, MOBILEBACKUP_SERVICE_NAME, &service); - if ((ret == LOCKDOWN_E_SUCCESS) && service->port) { + if ((ret == LOCKDOWN_E_SUCCESS) && service && service->port) { printf("Started \"%s\" service on port %d.\n", MOBILEBACKUP_SERVICE_NAME, service->port); mobilebackup_client_new(device, service, &mobilebackup); diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index 0353c9b..d70a7ae 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c @@ -489,7 +489,7 @@ static void do_post_notification(idevice_t device, const char *notification) } lockdownd_start_service(lockdown, NP_SERVICE_NAME, &service); - if (service->port) { + if (service && service->port) { np_client_new(device, service, &np); if (np) { np_post_notification(np, notification); @@ -1557,7 +1557,7 @@ int main(int argc, char *argv[]) /* start notification_proxy */ np_client_t np = NULL; ret = lockdownd_start_service(lockdown, NP_SERVICE_NAME, &service); - if ((ret == LOCKDOWN_E_SUCCESS) && service->port) { + if ((ret == LOCKDOWN_E_SUCCESS) && service && service->port) { np_client_new(device, service, &np); np_set_notify_callback(np, notify_cb, NULL); const char *noties[5] = { @@ -1572,11 +1572,6 @@ int main(int argc, char *argv[]) printf("ERROR: Could not start service %s.\n", NP_SERVICE_NAME); } - if (service) { - lockdownd_service_descriptor_free(service); - service = NULL; - } - afc_client_t afc = NULL; if (cmd == CMD_BACKUP) { /* start AFC, we need this for the lock file */ @@ -1596,7 +1591,7 @@ int main(int argc, char *argv[]) /* start mobilebackup service and retrieve port */ mobilebackup2_client_t mobilebackup2 = NULL; ret = lockdownd_start_service(lockdown, MOBILEBACKUP2_SERVICE_NAME, &service); - if ((ret == LOCKDOWN_E_SUCCESS) && service->port) { + if ((ret == LOCKDOWN_E_SUCCESS) && service && service->port) { PRINT_VERBOSE(1, "Started \"%s\" service on port %d.\n", MOBILEBACKUP2_SERVICE_NAME, service->port); mobilebackup2_client_new(device, service, &mobilebackup2); diff --git a/tools/idevicedebugserverproxy.c b/tools/idevicedebugserverproxy.c index 32438ad..3a25ebc 100644 --- a/tools/idevicedebugserverproxy.c +++ b/tools/idevicedebugserverproxy.c @@ -297,7 +297,7 @@ int main(int argc, char *argv[]) goto leave_cleanup; } - if ((lockdownd_start_service(lockdown, "com.apple.debugserver", &service) != LOCKDOWN_E_SUCCESS) || !service->port) { + if ((lockdownd_start_service(lockdown, "com.apple.debugserver", &service) != LOCKDOWN_E_SUCCESS) || !service || !service->port) { fprintf(stderr, "Could not start com.apple.debugserver!\nPlease make sure to mount the developer disk image first.\n"); result = EXIT_FAILURE; goto leave_cleanup; diff --git a/tools/idevicediagnostics.c b/tools/idevicediagnostics.c index 410d054..464df20 100644 --- a/tools/idevicediagnostics.c +++ b/tools/idevicediagnostics.c @@ -188,7 +188,7 @@ int main(int argc, char **argv) lockdownd_client_free(lockdown_client); - if ((ret == LOCKDOWN_E_SUCCESS) && (service->port > 0)) { + if ((ret == LOCKDOWN_E_SUCCESS) && service && (service->port > 0)) { if (diagnostics_relay_client_new(device, service, &diagnostics_client) != DIAGNOSTICS_RELAY_E_SUCCESS) { printf("Could not connect to diagnostics_relay!\n"); result = -1; diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c index 57a2e27..e57d83a 100644 --- a/tools/ideviceimagemounter.c +++ b/tools/ideviceimagemounter.c @@ -305,7 +305,7 @@ int main(int argc, char **argv) lockdownd_start_service(lckd, "com.apple.mobile.mobile_image_mounter", &service); - if (service->port == 0) { + if (!service || service->port == 0) { printf("ERROR: Could not start mobile_image_mounter service!\n"); goto leave; } @@ -323,7 +323,7 @@ int main(int argc, char **argv) if (!list_mode) { struct stat fst; if ((lockdownd_start_service(lckd, "com.apple.afc", &service) != - LOCKDOWN_E_SUCCESS) || !service->port) { + LOCKDOWN_E_SUCCESS) || !service || !service->port) { fprintf(stderr, "Could not start com.apple.afc!\n"); goto leave; } diff --git a/tools/idevicescreenshot.c b/tools/idevicescreenshot.c index 23e7b41..d056dd0 100644 --- a/tools/idevicescreenshot.c +++ b/tools/idevicescreenshot.c @@ -83,7 +83,7 @@ int main(int argc, char **argv) lockdownd_start_service(lckd, "com.apple.mobile.screenshotr", &service); lockdownd_client_free(lckd); - if (service->port > 0) { + if (service && service->port > 0) { if (screenshotr_client_new(device, service, &shotr) != SCREENSHOTR_E_SUCCESS) { printf("Could not connect to screenshotr!\n"); } else { |