Skip to content

Commit

Permalink
Fix pcap_loop() with a count of 0 and TPACKET_V3.
Browse files Browse the repository at this point in the history
A count of -1 *or* 0 should mean "loop forever", so only a count > 0
means to use the count to limit the number of packets to process.
  • Loading branch information
guyharris committed Dec 14, 2013
1 parent e366409 commit 1a52c9a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pcap-linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -4471,7 +4471,7 @@ pcap_read_linux_mmap_v3(pcap_t *handle, int max_packets, pcap_handler callback,
}
int packets_to_read = handlep->packets_left;

if (max_packets >= 0 && packets_to_read > max_packets) {
if (max_packets > 0 && packets_to_read > max_packets) {
packets_to_read = max_packets;
}

Expand Down

0 comments on commit 1a52c9a

Please sign in to comment.