summaryrefslogtreecommitdiffstats
path: root/tools/ideviceimagemounter.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/ideviceimagemounter.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/ideviceimagemounter.c')
-rw-r--r--tools/ideviceimagemounter.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c
index d56fa0c..7101c7e 100644
--- a/tools/ideviceimagemounter.c
+++ b/tools/ideviceimagemounter.c
@@ -63,7 +63,7 @@ static void print_usage(int argc, char **argv)
name = strrchr(argv[0], '/');
printf("Usage: %s [OPTIONS] IMAGE_FILE IMAGE_SIGNATURE_FILE\n\n", (name ? name + 1: argv[0]));
printf("Mounts the specified disk image on the device.\n\n");
- printf(" -u, --udid UDID\ttarget specific device by its 40-digit device UDID\n");
+ printf(" -u, --udid UDID\ttarget specific device by UDID\n");
printf(" -l, --list\t\tList mount information\n");
printf(" -t, --imagetype\tImage type to use, default is 'Developer'\n");
printf(" -x, --xml\t\tUse XML output\n");
@@ -76,19 +76,18 @@ 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", 0, NULL, 'u'},
- {"list", 0, NULL, 'l'},
- {"imagetype", 0, NULL, 't'},
- {"xml", 0, NULL, 'x'},
- {"debug", 0, NULL, 'd'},
+ {"help", no_argument, NULL, 'h'},
+ {"udid", required_argument, NULL, 'u'},
+ {"list", no_argument, NULL, 'l'},
+ {"imagetype", required_argument, NULL, 't'},
+ {"xml", no_argument, NULL, 'x'},
+ {"debug", no_argument, NULL, 'd'},
{NULL, 0, NULL, 0}
};
int c;
while (1) {
- c = getopt_long(argc, argv, "hu:lt:xd", longopts,
- (int *) 0);
+ c = getopt_long(argc, argv, "hu:lt:xd", longopts, NULL);
if (c == -1) {
break;
}
@@ -98,14 +97,12 @@ static void parse_opts(int argc, char **argv)
print_usage(argc, argv);
exit(0);
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);
}
- if (udid)
- free(udid);
+ free(udid);
udid = strdup(optarg);
break;
case 'l':