path: root/tools/idevice_id.c
diff options
authorGravatar Nikias Bassen2018-10-01 02:32:51 +0200
committerGravatar Nikias Bassen2018-10-01 02:32:51 +0200
commitb34e3435c21d06b3e5a4e7b5246fb6ddb6641a9f (patch)
tree89b78560cd956b956a03c9b207816d8cb345c37e /tools/idevice_id.c
parentf1ee0fd8b2b1dd65c64f5a67e208efc708295caa (diff)
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/idevice_id.c')
1 files changed, 3 insertions, 3 deletions
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) {
- 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)
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;