diff --git a/lustre/utils/llmount.c b/lustre/utils/llmount.c index ce28e09ff8dfd55cf106cccff491310b597abd02..87b64d3da38d981c580bb690d7dd9fe934773074 100644 --- a/lustre/utils/llmount.c +++ b/lustre/utils/llmount.c @@ -325,7 +325,7 @@ main(int argc, char * const argv[]) char * target = argv[2]; char * options = ""; int opt; - int i; + int i = 3; struct lustre_mount_data lmd; int rc; @@ -335,19 +335,29 @@ main(int argc, char * const argv[]) case 'v': verbose = 1; printf("verbose: %d\n", verbose); + i++; break; case 'n': nomtab = 1; printf("nomtab: %d\n", nomtab); + i++; break; case 'o': options = optarg; + i++; break; default: + i++; break; } } + if (argc < i) { + printf("Too few args!\n"); + printf("Usage: %s <source> <target> [-v] [-n] [-o ...]\n"); + exit(-1); + } + if (verbose) for (i = 0; i < argc; i++) { printf("arg[%d] = %s\n", i, argv[i]);