diff options
author | Nikias Bassen | 2012-11-29 03:42:06 +0100 |
---|---|---|
committer | Nikias Bassen | 2012-11-29 03:42:06 +0100 |
commit | 36c0192fbb16d068214d2640aecfb731ea24bfaa (patch) | |
tree | 4596eb003c5f074c4ca0b9e1e146680927916d11 /tools/idevicedebugserverproxy.c | |
parent | d2b82f9a8330a995a3e913adf734ac2b9ece9916 (diff) | |
download | libimobiledevice-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.c | 24 |
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[]) idevice_connection_t connection = NULL; idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; thread_t th; - char udid[41]; - udid[0] = 0; + const char* udid = NULL; uint16_t port = 0; uint16_t local_port = 0; int result = EXIT_SUCCESS; @@ -256,7 +255,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")) { @@ -281,22 +280,15 @@ int main(int argc, char *argv[]) } /* start services and connect to device */ - if (udid[0] != 0) { - ret = idevice_new(&device, udid); - if (ret != IDEVICE_E_SUCCESS) { + ret = idevice_new(&device, udid); + if (ret != IDEVICE_E_SUCCESS) { + if (udid) { fprintf(stderr, "No device found with udid %s, is it plugged in?\n", udid); - result = EXIT_FAILURE; - goto leave_cleanup; - } - } - else - { - ret = idevice_new(&device, NULL); - if (ret != IDEVICE_E_SUCCESS) { + } else { fprintf(stderr, "No device found, is it plugged in?\n"); - result = EXIT_FAILURE; - goto leave_cleanup; } + result = EXIT_FAILURE; + goto leave_cleanup; } if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lockdown, "idevicedebugserverproxy")) { |