diff options
| author | 2012-11-29 03:42:06 +0100 | |
|---|---|---|
| committer | 2012-11-29 03:42:06 +0100 | |
| commit | 36c0192fbb16d068214d2640aecfb731ea24bfaa (patch) | |
| tree | 4596eb003c5f074c4ca0b9e1e146680927916d11 /tools/idevicescreenshot.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/idevicescreenshot.c')
| -rw-r--r-- | tools/idevicescreenshot.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/tools/idevicescreenshot.c b/tools/idevicescreenshot.c index 766c7ac..cba62a2 100644 --- a/tools/idevicescreenshot.c +++ b/tools/idevicescreenshot.c | |||
| @@ -39,7 +39,7 @@ int main(int argc, char **argv) | |||
| 39 | uint16_t port = 0; | 39 | uint16_t port = 0; |
| 40 | int result = -1; | 40 | int result = -1; |
| 41 | int i; | 41 | int i; |
| 42 | char *udid = NULL; | 42 | const char *udid = NULL; |
| 43 | 43 | ||
| 44 | /* parse cmdline args */ | 44 | /* parse cmdline args */ |
| 45 | for (i = 1; i < argc; i++) { | 45 | for (i = 1; i < argc; i++) { |
| @@ -53,7 +53,7 @@ int main(int argc, char **argv) | |||
| 53 | print_usage(argc, argv); | 53 | print_usage(argc, argv); |
| 54 | return 0; | 54 | return 0; |
| 55 | } | 55 | } |
| 56 | udid = strdup(argv[i]); | 56 | udid = argv[i]; |
| 57 | continue; | 57 | continue; |
| 58 | } | 58 | } |
| 59 | else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { | 59 | else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { |
| @@ -67,15 +67,13 @@ int main(int argc, char **argv) | |||
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | if (IDEVICE_E_SUCCESS != idevice_new(&device, udid)) { | 69 | if (IDEVICE_E_SUCCESS != idevice_new(&device, udid)) { |
| 70 | printf("No device found, is it plugged in?\n"); | ||
| 71 | if (udid) { | 70 | if (udid) { |
| 72 | free(udid); | 71 | printf("No device found with udid %s, is it plugged in?\n", udid); |
| 72 | } else { | ||
| 73 | printf("No device found, is it plugged in?\n"); | ||
| 73 | } | 74 | } |
| 74 | return -1; | 75 | return -1; |
| 75 | } | 76 | } |
| 76 | if (udid) { | ||
| 77 | free(udid); | ||
| 78 | } | ||
| 79 | 77 | ||
| 80 | if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lckd, NULL)) { | 78 | if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lckd, NULL)) { |
| 81 | idevice_free(device); | 79 | idevice_free(device); |
