From 6f8b775582b07076ed0b2a1c0d7b1c74caf385f1 Mon Sep 17 00:00:00 2001 From: youfeng <youfeng> Date: Tue, 9 Mar 2004 01:23:03 +0000 Subject: [PATCH] b 2295 r Adilger fix a llmount, mount.lustre segment fault bug --- lustre/utils/llmount.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lustre/utils/llmount.c b/lustre/utils/llmount.c index ce28e09ff8..87b64d3da3 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]); -- GitLab