Without this fix, the struct config cfg variable only
gets set one time when argconfig_parse() is called. Any other
time it is attempted to be set, it acts as a read-only value
and continues to use the initial value it was set with.
This poses a problem for the discovery feature, discovery.conf file
as it is desired to make the file multiple line instead of a single
line, such as:
-t rdma -a 192.168.69.33 -s 4420 -q host2-proper-nqn
-t rdma -a 192.168.1.4 -s 4420 -q host2-proper-nqn
-t rdma -a 192.168.69.33 -s 99 -q host2-proper-nqn
I've tried the fix with a few existing commands and nothing
appears to be broken, but I haven't done an exhaustive test.
Reported-by: Jay Freyensee <james_p_freyensee@linux.intel.com>
Originally-by: Sagi Grimberg <sagi@lightbits.io>
Tested-by: Jay Freyensee <james_p_freyensee@linux.intel.com>
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) {