summaryrefslogtreecommitdiffstats
path: root/tools/idevicesyslog.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/idevicesyslog.c')
-rw-r--r--tools/idevicesyslog.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/idevicesyslog.c b/tools/idevicesyslog.c
index a17999c..6ce6d0e 100644
--- a/tools/idevicesyslog.c
+++ b/tools/idevicesyslog.c
@@ -49,7 +49,7 @@ int main(int argc, char *argv[])
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 const char* udid = NULL; 51 const char* udid = NULL;
52 uint16_t port = 0; 52 lockdownd_service_descriptor_t service = NULL;
53 53
54 signal(SIGINT, clean_exit); 54 signal(SIGINT, clean_exit);
55 signal(SIGTERM, clean_exit); 55 signal(SIGTERM, clean_exit);
@@ -99,13 +99,13 @@ int main(int argc, char *argv[])
99 } 99 }
100 100
101 /* start syslog_relay service and retrieve port */ 101 /* start syslog_relay service and retrieve port */
102 ret = lockdownd_start_service(client, "com.apple.syslog_relay", &port); 102 ret = lockdownd_start_service(client, "com.apple.syslog_relay", &service);
103 if ((ret == LOCKDOWN_E_SUCCESS) && port) { 103 if ((ret == LOCKDOWN_E_SUCCESS) && service->port) {
104 lockdownd_client_free(client); 104 lockdownd_client_free(client);
105 105
106 /* connect to socket relay messages */ 106 /* connect to socket relay messages */
107 idevice_connection_t conn = NULL; 107 idevice_connection_t conn = NULL;
108 if ((idevice_connect(device, port, &conn) != IDEVICE_E_SUCCESS) || !conn) { 108 if ((idevice_connect(device, service->port, &conn) != IDEVICE_E_SUCCESS) || !conn) {
109 printf("ERROR: Could not open usbmux connection.\n"); 109 printf("ERROR: Could not open usbmux connection.\n");
110 } else { 110 } else {
111 while (!quit_flag) { 111 while (!quit_flag) {
@@ -126,6 +126,9 @@ int main(int argc, char *argv[])
126 printf("ERROR: Could not start service com.apple.syslog_relay.\n"); 126 printf("ERROR: Could not start service com.apple.syslog_relay.\n");
127 } 127 }
128 128
129 if (service)
130 lockdownd_service_descriptor_free(service);
131
129 idevice_free(device); 132 idevice_free(device);
130 133
131 return 0; 134 return 0;