diff options
| author | 2014-10-11 22:12:04 +0200 | |
|---|---|---|
| committer | 2014-10-11 22:12:04 +0200 | |
| commit | fd43544a9251fcc698b0002967d45c251c203bb2 (patch) | |
| tree | f9b9c6f82a37bd386914eb1986349bb8b799e4cd | |
| parent | 75b0ba0d69bff5de42fb21ccd5650b78c2997dfa (diff) | |
| download | libimobiledevice-fd43544a9251fcc698b0002967d45c251c203bb2.tar.gz libimobiledevice-fd43544a9251fcc698b0002967d45c251c203bb2.tar.bz2 | |
tools: Make sure to print an error when lockdown connection fails
| -rw-r--r-- | tools/idevicebackup.c | 3 | ||||
| -rw-r--r-- | tools/idevicebackup2.c | 3 | ||||
| -rw-r--r-- | tools/idevicecrashreport.c | 1 | ||||
| -rw-r--r-- | tools/idevicedate.c | 4 | ||||
| -rw-r--r-- | tools/idevicedebugserverproxy.c | 5 | ||||
| -rw-r--r-- | tools/idevicediagnostics.c | 4 | ||||
| -rw-r--r-- | tools/ideviceenterrecovery.c | 4 | ||||
| -rw-r--r-- | tools/ideviceimagemounter.c | 5 | ||||
| -rw-r--r-- | tools/ideviceinfo.c | 4 | ||||
| -rw-r--r-- | tools/idevicename.c | 2 | ||||
| -rw-r--r-- | tools/idevicepair.c | 2 | ||||
| -rw-r--r-- | tools/ideviceprovision.c | 4 | ||||
| -rw-r--r-- | tools/idevicescreenshot.c | 5 |
13 files changed, 30 insertions, 16 deletions
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c index 2159566..c5315d2 100644 --- a/tools/idevicebackup.c +++ b/tools/idevicebackup.c | |||
| @@ -843,7 +843,8 @@ int main(int argc, char *argv[]) | |||
| 843 | } | 843 | } |
| 844 | } | 844 | } |
| 845 | 845 | ||
| 846 | if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &client, "idevicebackup")) { | 846 | if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &client, "idevicebackup"))) { |
| 847 | printf("ERROR: Could not connect to lockdownd, error code %d\n", ldret); | ||
| 847 | idevice_free(device); | 848 | idevice_free(device); |
| 848 | return -1; | 849 | return -1; |
| 849 | } | 850 | } |
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index 0370139..4fde24f 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c | |||
| @@ -1499,7 +1499,8 @@ int main(int argc, char *argv[]) | |||
| 1499 | } | 1499 | } |
| 1500 | 1500 | ||
| 1501 | lockdownd_client_t lockdown = NULL; | 1501 | lockdownd_client_t lockdown = NULL; |
| 1502 | if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lockdown, "idevicebackup2")) { | 1502 | if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lockdown, "idevicebackup2"))) { |
| 1503 | printf("ERROR: Could not connect to lockdownd, error code %d\n", ldret); | ||
| 1503 | idevice_free(device); | 1504 | idevice_free(device); |
| 1504 | return -1; | 1505 | return -1; |
| 1505 | } | 1506 | } |
diff --git a/tools/idevicecrashreport.c b/tools/idevicecrashreport.c index dbed041..de2edb5 100644 --- a/tools/idevicecrashreport.c +++ b/tools/idevicecrashreport.c | |||
| @@ -369,6 +369,7 @@ int main(int argc, char* argv[]) { | |||
| 369 | 369 | ||
| 370 | lockdownd_error = lockdownd_client_new_with_handshake(device, &lockdownd, "idevicecrashreport"); | 370 | lockdownd_error = lockdownd_client_new_with_handshake(device, &lockdownd, "idevicecrashreport"); |
| 371 | if (lockdownd_error != LOCKDOWN_E_SUCCESS) { | 371 | if (lockdownd_error != LOCKDOWN_E_SUCCESS) { |
| 372 | fprintf(stderr, "ERROR: Could not connect to lockdownd, error code %d\n", lockdownd_error); | ||
| 372 | idevice_free(device); | 373 | idevice_free(device); |
| 373 | return -1; | 374 | return -1; |
| 374 | } | 375 | } |
diff --git a/tools/idevicedate.c b/tools/idevicedate.c index e14d587..234a8fe 100644 --- a/tools/idevicedate.c +++ b/tools/idevicedate.c | |||
| @@ -56,6 +56,7 @@ static void print_usage(int argc, char **argv) | |||
| 56 | int main(int argc, char *argv[]) | 56 | int main(int argc, char *argv[]) |
| 57 | { | 57 | { |
| 58 | lockdownd_client_t client = NULL; | 58 | lockdownd_client_t client = NULL; |
| 59 | lockdownd_error_t ldret = LOCKDOWN_E_UNKNOWN_ERROR; | ||
| 59 | idevice_t device = NULL; | 60 | idevice_t device = NULL; |
| 60 | idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; | 61 | idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; |
| 61 | int i; | 62 | int i; |
| @@ -137,7 +138,8 @@ int main(int argc, char *argv[]) | |||
| 137 | return -1; | 138 | return -1; |
| 138 | } | 139 | } |
| 139 | 140 | ||
| 140 | if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &client, "idevicedate")) { | 141 | if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &client, "idevicedate"))) { |
| 142 | fprintf(stderr, "ERROR: Could not connect to lockdownd, error code %d\n", ldret); | ||
| 141 | result = -1; | 143 | result = -1; |
| 142 | goto cleanup; | 144 | goto cleanup; |
| 143 | } | 145 | } |
diff --git a/tools/idevicedebugserverproxy.c b/tools/idevicedebugserverproxy.c index baf3cd7..9ccb3c3 100644 --- a/tools/idevicedebugserverproxy.c +++ b/tools/idevicedebugserverproxy.c | |||
| @@ -223,6 +223,7 @@ static void* connection_handler(void* data) | |||
| 223 | int main(int argc, char *argv[]) | 223 | int main(int argc, char *argv[]) |
| 224 | { | 224 | { |
| 225 | lockdownd_client_t lockdown = NULL; | 225 | lockdownd_client_t lockdown = NULL; |
| 226 | lockdownd_error_t ldret = LOCKDOWN_E_UNKNOWN_ERROR; | ||
| 226 | idevice_t device = NULL; | 227 | idevice_t device = NULL; |
| 227 | idevice_connection_t connection = NULL; | 228 | idevice_connection_t connection = NULL; |
| 228 | idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; | 229 | idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; |
| @@ -291,8 +292,8 @@ int main(int argc, char *argv[]) | |||
| 291 | goto leave_cleanup; | 292 | goto leave_cleanup; |
| 292 | } | 293 | } |
| 293 | 294 | ||
| 294 | if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lockdown, "idevicedebugserverproxy")) { | 295 | if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lockdown, "idevicedebugserverproxy"))) { |
| 295 | fprintf(stderr, "Could not connect to lockdownd. Exiting.\n"); | 296 | fprintf(stderr, "ERROR: Could not connect to lockdownd, error code %d\n", ldret); |
| 296 | result = EXIT_FAILURE; | 297 | result = EXIT_FAILURE; |
| 297 | goto leave_cleanup; | 298 | goto leave_cleanup; |
| 298 | } | 299 | } |
diff --git a/tools/idevicediagnostics.c b/tools/idevicediagnostics.c index 216ebf1..491441d 100644 --- a/tools/idevicediagnostics.c +++ b/tools/idevicediagnostics.c | |||
| @@ -173,9 +173,9 @@ int main(int argc, char **argv) | |||
| 173 | goto cleanup; | 173 | goto cleanup; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lockdown_client, "idevicediagnostics")) { | 176 | if (LOCKDOWN_E_SUCCESS != (ret = lockdownd_client_new_with_handshake(device, &lockdown_client, "idevicediagnostics"))) { |
| 177 | idevice_free(device); | 177 | idevice_free(device); |
| 178 | printf("Unable to connect to lockdownd.\n"); | 178 | printf("ERROR: Could not connect to lockdownd, error code %d\n", ret); |
| 179 | goto cleanup; | 179 | goto cleanup; |
| 180 | } | 180 | } |
| 181 | 181 | ||
diff --git a/tools/ideviceenterrecovery.c b/tools/ideviceenterrecovery.c index 444d531..2747923 100644 --- a/tools/ideviceenterrecovery.c +++ b/tools/ideviceenterrecovery.c | |||
| @@ -42,6 +42,7 @@ static void print_usage(int argc, char **argv) | |||
| 42 | int main(int argc, char *argv[]) | 42 | int main(int argc, char *argv[]) |
| 43 | { | 43 | { |
| 44 | lockdownd_client_t client = NULL; | 44 | lockdownd_client_t client = NULL; |
| 45 | lockdownd_error_t ldret = LOCKDOWN_E_UNKNOWN_ERROR; | ||
| 45 | idevice_t device = NULL; | 46 | idevice_t device = NULL; |
| 46 | idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; | 47 | idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; |
| 47 | int i; | 48 | int i; |
| @@ -72,7 +73,8 @@ int main(int argc, char *argv[]) | |||
| 72 | return -1; | 73 | return -1; |
| 73 | } | 74 | } |
| 74 | 75 | ||
| 75 | if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(device, &client, "ideviceenterrecovery")) { | 76 | if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new(device, &client, "ideviceenterrecovery"))) { |
| 77 | printf("ERROR: Could not connect to lockdownd, error code %d\n", ldret); | ||
| 76 | idevice_free(device); | 78 | idevice_free(device); |
| 77 | return -1; | 79 | return -1; |
| 78 | } | 80 | } |
diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c index 29d25d7..9ce25c9 100644 --- a/tools/ideviceimagemounter.c +++ b/tools/ideviceimagemounter.c | |||
| @@ -138,6 +138,7 @@ int main(int argc, char **argv) | |||
| 138 | { | 138 | { |
| 139 | idevice_t device = NULL; | 139 | idevice_t device = NULL; |
| 140 | lockdownd_client_t lckd = NULL; | 140 | lockdownd_client_t lckd = NULL; |
| 141 | lockdownd_error_t ldret = LOCKDOWN_E_UNKNOWN_ERROR; | ||
| 141 | mobile_image_mounter_client_t mim = NULL; | 142 | mobile_image_mounter_client_t mim = NULL; |
| 142 | afc_client_t afc = NULL; | 143 | afc_client_t afc = NULL; |
| 143 | lockdownd_service_descriptor_t service = NULL; | 144 | lockdownd_service_descriptor_t service = NULL; |
| @@ -172,8 +173,8 @@ int main(int argc, char **argv) | |||
| 172 | return -1; | 173 | return -1; |
| 173 | } | 174 | } |
| 174 | 175 | ||
| 175 | if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lckd, "ideviceimagemounter")) { | 176 | if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lckd, "ideviceimagemounter"))) { |
| 176 | printf("ERROR: could not connect to lockdown. Exiting.\n"); | 177 | printf("ERROR: Could not connect to lockdown, error code %d.\n", ldret); |
| 177 | goto leave; | 178 | goto leave; |
| 178 | } | 179 | } |
| 179 | 180 | ||
diff --git a/tools/ideviceinfo.c b/tools/ideviceinfo.c index 7b3b924..005023a 100644 --- a/tools/ideviceinfo.c +++ b/tools/ideviceinfo.c | |||
| @@ -103,6 +103,7 @@ static void print_usage(int argc, char **argv) | |||
| 103 | int main(int argc, char *argv[]) | 103 | int main(int argc, char *argv[]) |
| 104 | { | 104 | { |
| 105 | lockdownd_client_t client = NULL; | 105 | lockdownd_client_t client = NULL; |
| 106 | lockdownd_error_t ldret = LOCKDOWN_E_UNKNOWN_ERROR; | ||
| 106 | idevice_t device = NULL; | 107 | idevice_t device = NULL; |
| 107 | idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; | 108 | idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; |
| 108 | int i; | 109 | int i; |
| @@ -179,9 +180,10 @@ int main(int argc, char *argv[]) | |||
| 179 | return -1; | 180 | return -1; |
| 180 | } | 181 | } |
| 181 | 182 | ||
| 182 | if (LOCKDOWN_E_SUCCESS != (simple ? | 183 | if (LOCKDOWN_E_SUCCESS != (ldret = simple ? |
| 183 | lockdownd_client_new(device, &client, "ideviceinfo"): | 184 | lockdownd_client_new(device, &client, "ideviceinfo"): |
| 184 | lockdownd_client_new_with_handshake(device, &client, "ideviceinfo"))) { | 185 | lockdownd_client_new_with_handshake(device, &client, "ideviceinfo"))) { |
| 186 | fprintf(stderr, "ERROR: Could not connect to lockdownd, error code %d\n", ldret); | ||
| 185 | idevice_free(device); | 187 | idevice_free(device); |
| 186 | return -1; | 188 | return -1; |
| 187 | } | 189 | } |
diff --git a/tools/idevicename.c b/tools/idevicename.c index 7e4c372..c013edc 100644 --- a/tools/idevicename.c +++ b/tools/idevicename.c | |||
| @@ -87,7 +87,7 @@ int main(int argc, char** argv) | |||
| 87 | lockdownd_error_t lerr = lockdownd_client_new_with_handshake(device, &lockdown, "idevicename"); | 87 | lockdownd_error_t lerr = lockdownd_client_new_with_handshake(device, &lockdown, "idevicename"); |
| 88 | if (lerr != LOCKDOWN_E_SUCCESS) { | 88 | if (lerr != LOCKDOWN_E_SUCCESS) { |
| 89 | idevice_free(device); | 89 | idevice_free(device); |
| 90 | fprintf(stderr, "ERROR: lockdown connection failed, lockdown error %d\n", lerr); | 90 | fprintf(stderr, "ERROR: Could not connect to lockdownd, error code %d\n", lerr); |
| 91 | return -1; | 91 | return -1; |
| 92 | } | 92 | } |
| 93 | 93 | ||
diff --git a/tools/idevicepair.c b/tools/idevicepair.c index 872d44a..d02a258 100644 --- a/tools/idevicepair.c +++ b/tools/idevicepair.c | |||
| @@ -226,7 +226,7 @@ int main(int argc, char **argv) | |||
| 226 | lerr = lockdownd_client_new(device, &client, "idevicepair"); | 226 | lerr = lockdownd_client_new(device, &client, "idevicepair"); |
| 227 | if (lerr != LOCKDOWN_E_SUCCESS) { | 227 | if (lerr != LOCKDOWN_E_SUCCESS) { |
| 228 | idevice_free(device); | 228 | idevice_free(device); |
| 229 | printf("ERROR: lockdownd_client_new failed with error code %d\n", lerr); | 229 | printf("ERROR: Could not connect to lockdownd, error code %d\n", lerr); |
| 230 | return EXIT_FAILURE; | 230 | return EXIT_FAILURE; |
| 231 | } | 231 | } |
| 232 | 232 | ||
diff --git a/tools/ideviceprovision.c b/tools/ideviceprovision.c index 82e929d..2e13e8b 100644 --- a/tools/ideviceprovision.c +++ b/tools/ideviceprovision.c | |||
| @@ -244,6 +244,7 @@ static int profile_read_from_file(const char* path, unsigned char **profile_data | |||
| 244 | int main(int argc, char *argv[]) | 244 | int main(int argc, char *argv[]) |
| 245 | { | 245 | { |
| 246 | lockdownd_client_t client = NULL; | 246 | lockdownd_client_t client = NULL; |
| 247 | lockdownd_error_t ldret = LOCKDOWN_E_UNKNOWN_ERROR; | ||
| 247 | lockdownd_service_descriptor_t service = NULL; | 248 | lockdownd_service_descriptor_t service = NULL; |
| 248 | idevice_t device = NULL; | 249 | idevice_t device = NULL; |
| 249 | idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; | 250 | idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; |
| @@ -377,7 +378,8 @@ int main(int argc, char *argv[]) | |||
| 377 | return -1; | 378 | return -1; |
| 378 | } | 379 | } |
| 379 | 380 | ||
| 380 | if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &client, "ideviceprovision")) { | 381 | if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &client, "ideviceprovision"))) { |
| 382 | fprintf(stderr, "ERROR: Could not connect to lockdownd, error code %d\n", ldret); | ||
| 381 | idevice_free(device); | 383 | idevice_free(device); |
| 382 | return -1; | 384 | return -1; |
| 383 | } | 385 | } |
diff --git a/tools/idevicescreenshot.c b/tools/idevicescreenshot.c index 486265e..bc3793a 100644 --- a/tools/idevicescreenshot.c +++ b/tools/idevicescreenshot.c | |||
| @@ -35,6 +35,7 @@ int main(int argc, char **argv) | |||
| 35 | { | 35 | { |
| 36 | idevice_t device = NULL; | 36 | idevice_t device = NULL; |
| 37 | lockdownd_client_t lckd = NULL; | 37 | lockdownd_client_t lckd = NULL; |
| 38 | lockdownd_error_t ldret = LOCKDOWN_E_UNKNOWN_ERROR; | ||
| 38 | screenshotr_client_t shotr = NULL; | 39 | screenshotr_client_t shotr = NULL; |
| 39 | lockdownd_service_descriptor_t service = NULL; | 40 | lockdownd_service_descriptor_t service = NULL; |
| 40 | int result = -1; | 41 | int result = -1; |
| @@ -80,9 +81,9 @@ int main(int argc, char **argv) | |||
| 80 | return -1; | 81 | return -1; |
| 81 | } | 82 | } |
| 82 | 83 | ||
| 83 | if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lckd, NULL)) { | 84 | if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lckd, NULL))) { |
| 84 | idevice_free(device); | 85 | idevice_free(device); |
| 85 | printf("Exiting.\n"); | 86 | printf("ERROR: Could not connect to lockdownd, error code %d\n", ldret); |
| 86 | return -1; | 87 | return -1; |
| 87 | } | 88 | } |
| 88 | 89 | ||
