summaryrefslogtreecommitdiffstats
path: root/util/argconfig.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-07-26 05:11:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-07-26 05:11:33 +0000
commita751023422eadf87cd8d6484878193a4914a9d85 (patch)
tree3fca0ae6325173fc2583e7d88abe4c38e6193277 /util/argconfig.c
parentAdding upstream version 2.0. (diff)
downloadnvme-cli-a751023422eadf87cd8d6484878193a4914a9d85.tar.xz
nvme-cli-a751023422eadf87cd8d6484878193a4914a9d85.zip
Adding upstream version 2.1~rc0.upstream/2.1_rc0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'util/argconfig.c')
-rw-r--r--util/argconfig.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/util/argconfig.c b/util/argconfig.c
index 59d8f1d..d09ba9d 100644
--- a/util/argconfig.c
+++ b/util/argconfig.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright 2014 PMC-Sierra, Inc.
*
@@ -135,7 +136,7 @@ void argconfig_print_help(const char *program_desc,
return;
printf("\n\033[1mOptions:\033[0m\n");
- for (s = options; (s->option != NULL) && (s != NULL); s++)
+ for (s = options; (s != NULL) && (s->option != NULL); s++)
show_option(s);
}
@@ -528,7 +529,8 @@ void argconfig_register_help_func(argconfig_help_func * f)
for (i = 0; i < MAX_HELP_FUNC; i++) {
if (help_funcs[i] == NULL) {
help_funcs[i] = f;
- help_funcs[i + 1] = NULL;
+ if (i < MAX_HELP_FUNC - 1)
+ help_funcs[i + 1] = NULL;
break;
}
}