diff options
author | Martin Szulecki | 2010-07-08 15:38:38 +0200 |
---|---|---|
committer | Martin Szulecki | 2010-07-08 15:38:38 +0200 |
commit | 89436938ba55bdac2162970b37608666a68a1bb7 (patch) | |
tree | 1b156ba8df23cf5d02e4effd30b688fb4dfd4d92 /src | |
parent | af07bf36689bb07a6b862deb69c0391717c73a51 (diff) | |
download | idevicerestore-89436938ba55bdac2162970b37608666a68a1bb7.tar.gz idevicerestore-89436938ba55bdac2162970b37608666a68a1bb7.tar.bz2 |
Fix segfault and handling of cli arguments
Diffstat (limited to 'src')
-rw-r--r-- | src/idevicerestore.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c index 38e765d..37577b0 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -47,7 +47,7 @@ static struct option longopts[] = { }; void usage(int argc, char* argv[]) { - char *name = strrchr(argv[0], '/'); + char* name = strrchr(argv[0], '/'); printf("Usage: %s [OPTIONS] FILE\n", (name ? name + 1 : argv[0])); printf("Restore/upgrade IPSW firmware FILE to an iPhone/iPod Touch.\n"); printf(" -u, --uuid UUID\ttarget specific device by its 40-digit device UUID\n"); @@ -78,7 +78,7 @@ int main(int argc, char* argv[]) { switch (opt) { case 'h': usage(argc, argv); - break; + return 0; case 'd': client->flags &= FLAG_DEBUG; @@ -106,10 +106,10 @@ int main(int argc, char* argv[]) { } } - argc -= optind; - argv += optind; + if ((argc-optind) == 1) { + argc -= optind; + argv += optind; - if (argc == 1) { ipsw = argv[0]; } else { usage(argc, argv); |