examples: fix port mask parsing failure handling
authorSarosh Arif <sarosh.arif@emumba.com>
Thu, 11 Jun 2020 12:36:24 +0000 (17:36 +0500)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 30 Jul 2020 21:24:40 +0000 (23:24 +0200)
commitce6b8c31548b4d71a986d9807cd06cf3a616d1ab
tree209b5a22c1c6e29976a249e116f0a73bc6f55e39
parent98ffdfbcf1ea8f4705fa3dacd6d9ae94d3705733
examples: fix port mask parsing failure handling

Giving invalid or zero portmask as command line option to
these applications will have an unexpected response.
The reason behind this is that the return value of function
that parses portmask is stored in a variable whose datatype is
unsigned int, hence returning -1 in case of zero or
invalid portmask causes an unexpected behaviour.
If we return 0 instead of -1 this issue can be resolved.
The program already contains the functionality to print
"invalid portmask" and program usage if zero is returned.

Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
21 files changed:
examples/distributor/main.c
examples/ioat/ioatfwd.c
examples/ip_reassembly/main.c
examples/l2fwd-event/main.c
examples/l2fwd-jobstats/main.c
examples/l2fwd-keepalive/main.c
examples/l2fwd/main.c
examples/l3fwd-acl/main.c
examples/l3fwd-graph/main.c
examples/l3fwd-power/main.c
examples/l3fwd/main.c
examples/link_status_interrupt/main.c
examples/packet_ordering/main.c
examples/performance-thread/l3fwd-thread/main.c
examples/ptpclient/ptpclient.c
examples/qos_meter/main.c
examples/tep_termination/main.c
examples/vhost/main.c
examples/vm_power_manager/main.c
examples/vmdq/main.c
examples/vmdq_dcb/main.c