path: root/test/test-pipeline
diff options
authorKeith Wiles <>2017-02-14 16:09:41 -0600
committerThomas Monjalon <>2017-03-10 15:38:47 +0100
commit9d5ca5323910591f2cafbac5070fcb5b6d02d022 (patch)
treef6bc89813b796a03e8ffa75cb5f0b55927c32240 /test/test-pipeline
parent2deb6b5246d7706448d070335b329d1acb754cee (diff)
examples: fix optind reset
The variable optind should be reset to one not zero. From the man page: "The variable optind is the index of the next element to be processed in argv. The system initializes this value to 1. The caller can reset it to 1 to restart scanning of the same argv, or when scanning a new argument vector.” The problem I saw with my application was trying to parse the wrong option, which can happen as DPDK parses the first part of the command line and the application parses the second part. If you call getopt() multiple times in the same execution, the behavior is not maintained when using zero for optind. Signed-off-by: Keith Wiles <>
Diffstat (limited to 'test/test-pipeline')
1 files changed, 1 insertions, 1 deletions
diff --git a/test/test-pipeline/config.c b/test/test-pipeline/config.c
index dd80ed6..1b397c0 100644
--- a/test/test-pipeline/config.c
+++ b/test/test-pipeline/config.c
@@ -259,6 +259,6 @@ app_parse_args(int argc, char **argv)
argv[optind - 1] = prgname;
ret = optind - 1;
- optind = 0; /* reset getopt lib */
+ optind = 1; /* reset getopt lib */
return ret;