summaryrefslogtreecommitdiffstats
path: root/tools/idevicedebugserverproxy.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2012-11-29 03:42:06 +0100
committerGravatar Nikias Bassen2012-11-29 03:42:06 +0100
commit36c0192fbb16d068214d2640aecfb731ea24bfaa (patch)
tree4596eb003c5f074c4ca0b9e1e146680927916d11 /tools/idevicedebugserverproxy.c
parentd2b82f9a8330a995a3e913adf734ac2b9ece9916 (diff)
downloadlibimobiledevice-36c0192fbb16d068214d2640aecfb731ea24bfaa.tar.gz
libimobiledevice-36c0192fbb16d068214d2640aecfb731ea24bfaa.tar.bz2
tools: use pointer instead of static buffer for UDID since it can start with '0'
Diffstat (limited to 'tools/idevicedebugserverproxy.c')
-rw-r--r--tools/idevicedebugserverproxy.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/tools/idevicedebugserverproxy.c b/tools/idevicedebugserverproxy.c
index 83aa479..1026fa2 100644
--- a/tools/idevicedebugserverproxy.c
+++ b/tools/idevicedebugserverproxy.c
@@ -227,8 +227,7 @@ int main(int argc, char *argv[])
227 idevice_connection_t connection = NULL; 227 idevice_connection_t connection = NULL;
228 idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; 228 idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR;
229 thread_t th; 229 thread_t th;
230 char udid[41]; 230 const char* udid = NULL;
231 udid[0] = 0;
232 uint16_t port = 0; 231 uint16_t port = 0;
233 uint16_t local_port = 0; 232 uint16_t local_port = 0;
234 int result = EXIT_SUCCESS; 233 int result = EXIT_SUCCESS;
@@ -256,7 +255,7 @@ int main(int argc, char *argv[])
256 print_usage(argc, argv); 255 print_usage(argc, argv);
257 return 0; 256 return 0;
258 } 257 }
259 strcpy(udid, argv[i]); 258 udid = argv[i];
260 continue; 259 continue;
261 } 260 }
262 else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { 261 else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
@@ -281,22 +280,15 @@ int main(int argc, char *argv[])
281 } 280 }
282 281
283 /* start services and connect to device */ 282 /* start services and connect to device */
284 if (udid[0] != 0) { 283 ret = idevice_new(&device, udid);
285 ret = idevice_new(&device, udid); 284 if (ret != IDEVICE_E_SUCCESS) {
286 if (ret != IDEVICE_E_SUCCESS) { 285 if (udid) {
287 fprintf(stderr, "No device found with udid %s, is it plugged in?\n", udid); 286 fprintf(stderr, "No device found with udid %s, is it plugged in?\n", udid);
288 result = EXIT_FAILURE; 287 } else {
289 goto leave_cleanup;
290 }
291 }
292 else
293 {
294 ret = idevice_new(&device, NULL);
295 if (ret != IDEVICE_E_SUCCESS) {
296 fprintf(stderr, "No device found, is it plugged in?\n"); 288 fprintf(stderr, "No device found, is it plugged in?\n");
297 result = EXIT_FAILURE;
298 goto leave_cleanup;
299 } 289 }
290 result = EXIT_FAILURE;
291 goto leave_cleanup;
300 } 292 }
301 293
302 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lockdown, "idevicedebugserverproxy")) { 294 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lockdown, "idevicedebugserverproxy")) {