* [PATCH nvme-cli] argconfig: Rewind optind before looping on getopt_long
@ 2016-10-13 15:40 Sagi Grimberg
2016-10-13 16:10 ` Keith Busch
0 siblings, 1 reply; 4+ messages in thread
From: Sagi Grimberg @ 2016-10-13 15:40 UTC (permalink / raw)
In conf file based discovery we can call argconfig_parse
multiple times.
Reported-by: Jay Freyensee <james_p_freyensee at linux.intel.com>
Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
---
argconfig.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/argconfig.c b/argconfig.c
index e2bb7ab26446..bda8b03c1cbd 100644
--- a/argconfig.c
+++ b/argconfig.c
@@ -193,6 +193,7 @@ int argconfig_parse(int argc, char *argv[], const char *program_desc,
short_opts[short_index++] = 'h';
short_opts[short_index] = 0;
+ optind = 0;
while ((c = getopt_long_only(argc, argv, short_opts, long_opts,
&option_index)) != -1) {
if (c != 0) {
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH nvme-cli] argconfig: Rewind optind before looping on getopt_long
2016-10-13 15:40 [PATCH nvme-cli] argconfig: Rewind optind before looping on getopt_long Sagi Grimberg
@ 2016-10-13 16:10 ` Keith Busch
2016-10-13 16:00 ` Sagi Grimberg
0 siblings, 1 reply; 4+ messages in thread
From: Keith Busch @ 2016-10-13 16:10 UTC (permalink / raw)
On Thu, Oct 13, 2016@06:40:05PM +0300, Sagi Grimberg wrote:
> In conf file based discovery we can call argconfig_parse
> multiple times.
Jay beat you to it. :)
https://github.com/linux-nvme/nvme-cli/commit/2da2440f1e5e98df61b192446be7c68a170dcda6
> Reported-by: Jay Freyensee <james_p_freyensee at linux.intel.com>
> Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
> ---
> argconfig.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/argconfig.c b/argconfig.c
> index e2bb7ab26446..bda8b03c1cbd 100644
> --- a/argconfig.c
> +++ b/argconfig.c
> @@ -193,6 +193,7 @@ int argconfig_parse(int argc, char *argv[], const char *program_desc,
> short_opts[short_index++] = 'h';
> short_opts[short_index] = 0;
>
> + optind = 0;
> while ((c = getopt_long_only(argc, argv, short_opts, long_opts,
> &option_index)) != -1) {
> if (c != 0) {
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-10-13 16:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-13 15:40 [PATCH nvme-cli] argconfig: Rewind optind before looping on getopt_long Sagi Grimberg
2016-10-13 16:10 ` Keith Busch
2016-10-13 16:00 ` Sagi Grimberg
2016-10-13 16:40 ` J Freyensee
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.