summaryrefslogtreecommitdiffstats
path: root/tools/idevicename.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2018-10-01 02:32:51 +0200
committerGravatar Nikias Bassen2018-10-01 02:32:51 +0200
commitb34e3435c21d06b3e5a4e7b5246fb6ddb6641a9f (patch)
tree89b78560cd956b956a03c9b207816d8cb345c37e /tools/idevicename.c
parentf1ee0fd8b2b1dd65c64f5a67e208efc708295caa (diff)
downloadlibimobiledevice-b34e3435c21d06b3e5a4e7b5246fb6ddb6641a9f.tar.gz
libimobiledevice-b34e3435c21d06b3e5a4e7b5246fb6ddb6641a9f.tar.bz2
tools: Remove length check on device UDID arguments to support newer devices
The 40 characters length check on the device UDID made newer devices unusable with the libimobiledevice tools and was actually redundant since an invalid UDID will always fail to resolve. This commit removes the length check alltogether (but makes sure it is not an empty string "").
Diffstat (limited to 'tools/idevicename.c')
-rw-r--r--tools/idevicename.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/idevicename.c b/tools/idevicename.c
index 013becc..ef226f7 100644
--- a/tools/idevicename.c
+++ b/tools/idevicename.c
@@ -38,7 +38,7 @@ static void print_usage(void)
printf("Display the device name or set it to NAME if specified.\n");
printf("\n");
printf(" -d, --debug\t\tenable communication debugging\n");
- printf(" -u, --udid UDID\tuse UDID to target a specific device\n");
+ printf(" -u, --udid UDID\ttarget specific device by UDID\n");
printf(" -h, --help\t\tprint usage information\n");
printf("\n");
printf("Homepage: <" PACKAGE_URL ">\n");
@@ -60,6 +60,12 @@ int main(int argc, char** argv)
while ((c = getopt_long(argc, argv, "du:h", longopts, &optidx)) != -1) {
switch (c) {
case 'u':
+ if (!*optarg) {
+ fprintf(stderr, "ERROR: UDID must not be empty!\n");
+ print_usage();
+ exit(2);
+ }
+ free(udid);
udid = strdup(optarg);
break;
case 'h':