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/idevice_id.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tools/idevice_id.c') diff --git a/tools/idevice_id.c b/tools/idevice_id.c index 6f020ff..558dcbe 100644 --- a/tools/idevice_id.c +++ b/tools/idevice_id.c @@ -40,7 +40,7 @@ static void print_usage(int argc, char **argv) name = strrchr(argv[0], '/'); printf("Usage: %s [OPTIONS] [UDID]\n", (name ? name + 1: argv[0])); printf("Prints device name or a list of attached devices.\n\n"); - printf(" The UDID is a 40-digit hexadecimal number of the device\n"); + printf(" UDID is the unique device identifier of the device\n"); printf(" for which the name should be retrieved.\n\n"); printf(" -l, --list\t\tlist UDID of all attached devices\n"); printf(" -d, --debug\t\tenable communication debugging\n"); @@ -79,7 +79,7 @@ int main(int argc, char **argv) /* check if udid was passed */ if (mode == MODE_SHOW_ID) { i--; - if (!argv[i] || (strlen(argv[i]) != 40)) { + if (argc < 2 || !argv[i] || !*argv[i]) { print_usage(argc, argv); return 0; } @@ -90,7 +90,7 @@ int main(int argc, char **argv) case MODE_SHOW_ID: idevice_new(&device, udid); if (!device) { - fprintf(stderr, "ERROR: No device with UDID=%s attached.\n", udid); + fprintf(stderr, "ERROR: No device with UDID %s attached.\n", udid); return -2; } -- cgit v1.1-32-gdbae