The check that meant to check if pcap_dispatch processed fewer packets
than the desired number was inaccurate. It would also include all errors
(negative return values).
This patch considers only positive values for this check.
Fixes: 9fe08f2374f6 ("pcap: improve pcap_breakloop support")
int r = pcap_dispatch(ptv->pcap_handle, packet_q_len,
(pcap_handler)PcapCallbackLoop, (u_char *)ptv);
- if (unlikely(r == 0 || r == PCAP_ERROR_BREAK || r < packet_q_len)) {
+ if (unlikely(r == 0 || r == PCAP_ERROR_BREAK || (r > 0 && r < packet_q_len))) {
if (r == PCAP_ERROR_BREAK && ptv->cb_result == TM_ECODE_FAILED) {
SCReturnInt(TM_ECODE_FAILED);
}