From b34e3435c21d06b3e5a4e7b5246fb6ddb6641a9f Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Mon, 1 Oct 2018 02:32:51 +0200 Subject: 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 ""). --- tools/idevicepair.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tools/idevicepair.c') diff --git a/tools/idevicepair.c b/tools/idevicepair.c index b6f0751..6ae9103 100644 --- a/tools/idevicepair.c +++ b/tools/idevicepair.c @@ -72,7 +72,7 @@ static void print_usage(int argc, char **argv) printf(" list list devices paired with this host\n\n"); printf(" The following OPTIONS are accepted:\n"); printf(" -d, --debug enable communication debugging\n"); - printf(" -u, --udid UDID target specific device by its 40-digit device UDID\n"); + printf(" -u, --udid UDID target specific device by UDID\n"); printf(" -h, --help prints usage information\n"); printf("\n"); printf("Homepage: <" PACKAGE_URL ">\n"); @@ -81,9 +81,9 @@ static void print_usage(int argc, char **argv) static void parse_opts(int argc, char **argv) { static struct option longopts[] = { - {"help", 0, NULL, 'h'}, - {"udid", 1, NULL, 'u'}, - {"debug", 0, NULL, 'd'}, + {"help", no_argument, NULL, 'h'}, + {"udid", required_argument, NULL, 'u'}, + {"debug", no_argument, NULL, 'd'}, {NULL, 0, NULL, 0} }; int c; @@ -99,8 +99,8 @@ static void parse_opts(int argc, char **argv) print_usage(argc, argv); exit(EXIT_SUCCESS); case 'u': - if (strlen(optarg) != 40) { - printf("%s: invalid UDID specified (length != 40)\n", argv[0]); + if (!*optarg) { + fprintf(stderr, "ERROR: UDID must not be empty!\n"); print_usage(argc, argv); exit(2); } -- cgit v1.1-32-gdbae