Fix issue reported by Coverity.

Coverity ID 30701: Infinite loop: The loop does not have a normal
termination condition, so will continue until an abnormal condition
arises. In rte_netmap_poll: Infinite loop with unsatisfiable exit
condition.

Fixes: 06371afe394d ("examples/netmap_compat: import netmap
compatibility example")

Signed-off-by: Michal Kobylinski <michalx.kobylinski at intel.com>
---
v2:
- removed braces
- changed return value on -1

 examples/netmap_compat/lib/compat_netmap.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/examples/netmap_compat/lib/compat_netmap.c 
b/examples/netmap_compat/lib/compat_netmap.c
index bf1b418..112c551 100644
--- a/examples/netmap_compat/lib/compat_netmap.c
+++ b/examples/netmap_compat/lib/compat_netmap.c
@@ -865,6 +865,9 @@ rte_netmap_poll(struct pollfd *fds, nfds_t nfds, int 
timeout)
        uint32_t i, idx, port;
        uint32_t want_rx, want_tx;

+       if (timeout > 0)
+               return -1;
+
        ret = 0;
        do {
                for (i = 0; i < nfds; i++) {
-- 
1.9.1

Reply via email to