summaryrefslogtreecommitdiffstats
path: root/tools/idevicesyslog.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/idevicesyslog.c')
-rw-r--r--tools/idevicesyslog.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/tools/idevicesyslog.c b/tools/idevicesyslog.c
index 2adf327..73dd8e1 100644
--- a/tools/idevicesyslog.c
+++ b/tools/idevicesyslog.c
@@ -48,9 +48,8 @@ int main(int argc, char *argv[])
48 idevice_t phone = NULL; 48 idevice_t phone = NULL;
49 idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; 49 idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR;
50 int i; 50 int i;
51 char udid[41]; 51 const char* udid = NULL;
52 uint16_t port = 0; 52 uint16_t port = 0;
53 udid[0] = 0;
54 53
55 signal(SIGINT, clean_exit); 54 signal(SIGINT, clean_exit);
56 signal(SIGTERM, clean_exit); 55 signal(SIGTERM, clean_exit);
@@ -71,7 +70,7 @@ int main(int argc, char *argv[])
71 print_usage(argc, argv); 70 print_usage(argc, argv);
72 return 0; 71 return 0;
73 } 72 }
74 strcpy(udid, argv[i]); 73 udid = argv[i];
75 continue; 74 continue;
76 } 75 }
77 else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { 76 else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
@@ -84,20 +83,14 @@ int main(int argc, char *argv[])
84 } 83 }
85 } 84 }
86 85
87 if (udid[0] != 0) { 86 ret = idevice_new(&phone, udid);
88 ret = idevice_new(&phone, udid); 87 if (ret != IDEVICE_E_SUCCESS) {
89 if (ret != IDEVICE_E_SUCCESS) { 88 if (udid) {
90 printf("No device found with udid %s, is it plugged in?\n", udid); 89 printf("No device found with udid %s, is it plugged in?\n", udid);
91 return -1; 90 } else {
92 }
93 }
94 else
95 {
96 ret = idevice_new(&phone, NULL);
97 if (ret != IDEVICE_E_SUCCESS) {
98 printf("No device found, is it plugged in?\n"); 91 printf("No device found, is it plugged in?\n");
99 return -1;
100 } 92 }
93 return -1;
101 } 94 }
102 95
103 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "idevicesyslog")) { 96 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "idevicesyslog")) {