From: youfeng Date: Tue, 9 Mar 2004 01:23:03 +0000 (+0000) Subject: b 2295 X-Git-Tag: 1.2.2~234 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=6f8b775582b07076ed0b2a1c0d7b1c74caf385f1;p=fs%2Flustre-release.git b 2295 r Adilger fix a llmount, mount.lustre segment fault bug --- diff --git a/lustre/utils/llmount.c b/lustre/utils/llmount.c index ce28e09..87b64d3 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 [-v] [-n] [-o ...]\n"); + exit(-1); + } + if (verbose) for (i = 0; i < argc; i++) { printf("arg[%d] = %s\n", i, argv[i]);