Fix two coverity bugs where fcntl() return value not checked. Also mark some other cases as FAILED instead of skipped. Such as failure to transmit or failure to allocate mbuf's.
Coverity ID: 503765 Coverity ID: 503766 Signed-off-by: Stephen Hemminger <[email protected]> --- app/test/test_pmd_af_packet.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/test/test_pmd_af_packet.c b/app/test/test_pmd_af_packet.c index b668ca5b81..9fe595d606 100644 --- a/app/test/test_pmd_af_packet.c +++ b/app/test/test_pmd_af_packet.c @@ -556,19 +556,22 @@ test_af_packet_loopback(void) /* Set TAP fd to non-blocking for reading */ int flags = fcntl(tap_fd, F_GETFL, 0); - fcntl(tap_fd, F_SETFL, flags | O_NONBLOCK); + if (flags < 0 || fcntl(tap_fd, F_SETFL, flags | O_NONBLOCK) < 0) { + printf("fcntl failed: %s\n", strerror(errno)); + return TEST_FAILED; + } /* Allocate and send packets */ allocated = alloc_tx_mbufs(tx_bufs, BURST_SIZE); if (allocated == 0) { - printf("SKIPPED: Could not allocate mbufs\n"); - return TEST_SKIPPED; + printf("Could not allocate mbufs\n"); + return TEST_FAILED; } nb_tx = do_tx_burst(port_id, 0, tx_bufs, allocated); if (nb_tx == 0) { - printf("SKIPPED: No packets transmitted\n"); - return TEST_SKIPPED; + printf("No packets transmitted\n"); + return TEST_FAILED; } /* -- 2.53.0

