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[])
idevice_t phone = NULL;
idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR;
int i;
- char udid[41];
+ const char* udid = NULL;
uint16_t port = 0;
- udid[0] = 0;
signal(SIGINT, clean_exit);
signal(SIGTERM, clean_exit);
@@ -71,7 +70,7 @@ int main(int argc, char *argv[])
print_usage(argc, argv);
return 0;
}
- strcpy(udid, argv[i]);
+ udid = argv[i];
continue;
}
else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
@@ -84,20 +83,14 @@ int main(int argc, char *argv[])
}
}
- if (udid[0] != 0) {
- ret = idevice_new(&phone, udid);
- if (ret != IDEVICE_E_SUCCESS) {
+ ret = idevice_new(&phone, udid);
+ if (ret != IDEVICE_E_SUCCESS) {
+ if (udid) {
printf("No device found with udid %s, is it plugged in?\n", udid);
- return -1;
- }
- }
- else
- {
- ret = idevice_new(&phone, NULL);
- if (ret != IDEVICE_E_SUCCESS) {
+ } else {
printf("No device found, is it plugged in?\n");
- return -1;
}
+ return -1;
}
if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "idevicesyslog")) {