summaryrefslogtreecommitdiffstats
path: root/tools/ideviceinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/ideviceinfo.c')
-rw-r--r--tools/ideviceinfo.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/tools/ideviceinfo.c b/tools/ideviceinfo.c
index f3c8193..8635a48 100644
--- a/tools/ideviceinfo.c
+++ b/tools/ideviceinfo.c
@@ -285,14 +285,13 @@ int main(int argc, char *argv[])
285 int i; 285 int i;
286 int simple = 0; 286 int simple = 0;
287 int format = FORMAT_KEY_VALUE; 287 int format = FORMAT_KEY_VALUE;
288 char udid[41]; 288 const char* udid = NULL;
289 char *domain = NULL; 289 char *domain = NULL;
290 char *key = NULL; 290 char *key = NULL;
291 char *xml_doc = NULL; 291 char *xml_doc = NULL;
292 uint32_t xml_length; 292 uint32_t xml_length;
293 plist_t node = NULL; 293 plist_t node = NULL;
294 plist_type node_type; 294 plist_type node_type;
295 udid[0] = 0;
296 295
297 /* parse cmdline args */ 296 /* parse cmdline args */
298 for (i = 1; i < argc; i++) { 297 for (i = 1; i < argc; i++) {
@@ -306,7 +305,7 @@ int main(int argc, char *argv[])
306 print_usage(argc, argv); 305 print_usage(argc, argv);
307 return 0; 306 return 0;
308 } 307 }
309 strcpy(udid, argv[i]); 308 udid = argv[i];
310 continue; 309 continue;
311 } 310 }
312 else if (!strcmp(argv[i], "-q") || !strcmp(argv[i], "--domain")) { 311 else if (!strcmp(argv[i], "-q") || !strcmp(argv[i], "--domain")) {
@@ -348,20 +347,14 @@ int main(int argc, char *argv[])
348 } 347 }
349 } 348 }
350 349
351 if (udid[0] != 0) { 350 ret = idevice_new(&phone, udid);
352 ret = idevice_new(&phone, udid); 351 if (ret != IDEVICE_E_SUCCESS) {
353 if (ret != IDEVICE_E_SUCCESS) { 352 if (udid) {
354 printf("No device found with udid %s, is it plugged in?\n", udid); 353 printf("No device found with udid %s, is it plugged in?\n", udid);
355 return -1; 354 } else {
356 }
357 }
358 else
359 {
360 ret = idevice_new(&phone, NULL);
361 if (ret != IDEVICE_E_SUCCESS) {
362 printf("No device found, is it plugged in?\n"); 355 printf("No device found, is it plugged in?\n");
363 return -1;
364 } 356 }
357 return -1;
365 } 358 }
366 359
367 if (LOCKDOWN_E_SUCCESS != (simple ? 360 if (LOCKDOWN_E_SUCCESS != (simple ?