summaryrefslogtreecommitdiffstats
path: root/tools/idevicediagnostics.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/idevicediagnostics.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/idevicediagnostics.c')
-rw-r--r--tools/idevicediagnostics.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/tools/idevicediagnostics.c b/tools/idevicediagnostics.c
index 3c7f0ac..10dab77 100644
--- a/tools/idevicediagnostics.c
+++ b/tools/idevicediagnostics.c
@@ -60,7 +60,7 @@ int main(int argc, char **argv)
60 uint16_t port = 0; 60 uint16_t port = 0;
61 int result = -1; 61 int result = -1;
62 int i; 62 int i;
63 char *udid = NULL; 63 const char *udid = NULL;
64 int cmd = CMD_NONE; 64 int cmd = CMD_NONE;
65 char* cmd_arg = NULL; 65 char* cmd_arg = NULL;
66 plist_t node = NULL; 66 plist_t node = NULL;
@@ -79,7 +79,7 @@ int main(int argc, char **argv)
79 result = 0; 79 result = 0;
80 goto cleanup; 80 goto cleanup;
81 } 81 }
82 udid = strdup(argv[i]); 82 udid = argv[i];
83 continue; 83 continue;
84 } 84 }
85 else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { 85 else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
@@ -165,14 +165,14 @@ int main(int argc, char **argv)
165 } 165 }
166 166
167 if (IDEVICE_E_SUCCESS != idevice_new(&device, udid)) { 167 if (IDEVICE_E_SUCCESS != idevice_new(&device, udid)) {
168 printf("No device found, is it plugged in?\n"); 168 if (udid) {
169 printf("No device found with udid %s, is it plugged in?\n", udid);
170 } else {
171 printf("No device found, is it plugged in?\n");
172 }
169 goto cleanup; 173 goto cleanup;
170 } 174 }
171 175
172 if (udid) {
173 free(udid);
174 }
175
176 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lockdown_client, NULL)) { 176 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lockdown_client, NULL)) {
177 idevice_free(device); 177 idevice_free(device);
178 printf("Unable to connect to lockdownd.\n"); 178 printf("Unable to connect to lockdownd.\n");
@@ -261,9 +261,6 @@ int main(int argc, char **argv)
261 idevice_free(device); 261 idevice_free(device);
262 262
263cleanup: 263cleanup:
264 if (udid) {
265 free(udid);
266 }
267 if (node) { 264 if (node) {
268 plist_free(node); 265 plist_free(node);
269 } 266 }