eal: turn off getopt_long error messages

Message ID 20181216164559.89835-1-keith.wiles@intel.com
State New
Delegated to: Thomas Monjalon
Headers show
Series
  • eal: turn off getopt_long error messages
Related show

Checks

Context Check Description
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Wiles, Keith Dec. 16, 2018, 4:45 p.m.
When using dpdk register option api when parsing for log level
the opterr flags was still set to one causing an error message
from getopt_long(). Set opterr to zero to disable error messages.

Signed-off-by: Keith Wiles <keith.wiles@intel.com>
---
 lib/librte_eal/bsdapp/eal/eal.c   | 1 +
 lib/librte_eal/linuxapp/eal/eal.c | 1 +
 2 files changed, 2 insertions(+)

Comments

Thomas Monjalon Dec. 19, 2018, 8:35 p.m. | #1
16/12/2018 17:45, Keith Wiles:
> When using dpdk register option api when parsing for log level
> the opterr flags was still set to one causing an error message
> from getopt_long(). Set opterr to zero to disable error messages.

Please could you be more specific?
Which function call? Which error message?

We need also Fixes: and stable tags for backport.
Thanks
Thomas Monjalon Jan. 14, 2019, 2:02 p.m. | #2
Keith, it seems you missed my questions below:

19/12/2018 21:35, Thomas Monjalon:
> 16/12/2018 17:45, Keith Wiles:
> > When using dpdk register option api when parsing for log level
> > the opterr flags was still set to one causing an error message
> > from getopt_long(). Set opterr to zero to disable error messages.
> 
> Please could you be more specific?
> Which function call? Which error message?
> 
> We need also Fixes: and stable tags for backport.
> Thanks

Patch

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index b8152a75c..85d6dddc9 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -374,6 +374,7 @@  eal_log_level_parse(int argc, char **argv)
 	argvopt = argv;
 	optind = 1;
 	optreset = 1;
+	opterr = 0;
 
 	while ((opt = getopt_long(argc, argvopt, eal_short_options,
 				  eal_long_options, &option_index)) != EOF) {
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 361744d40..9a1289532 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -565,6 +565,7 @@  eal_log_level_parse(int argc, char **argv)
 
 	argvopt = argv;
 	optind = 1;
+	opterr = 0;
 
 	while ((opt = getopt_long(argc, argvopt, eal_short_options,
 				  eal_long_options, &option_index)) != EOF) {