From: guy Date: Sat, 2 Feb 2008 20:42:35 +0000 (+0000) Subject: Explicitly check for a positive "cnt" argument, as at least some other X-Git-Tag: libpcap-1.1.0~372 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/43b6c2d818975c0515036b69e9f83c5574b47dbc?hp=d46f258195a0c4b08e5057feee8cb475d0485b1c Explicitly check for a positive "cnt" argument, as at least some other read_op loops do, to clarify that a zero or negative "cnt" value means "loop until we run out of packets". --- diff --git a/pcap-dag.c b/pcap-dag.c index f53fe237..207f5f3c 100644 --- a/pcap-dag.c +++ b/pcap-dag.c @@ -17,7 +17,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/libpcap/pcap-dag.c,v 1.35 2008-01-06 21:25:54 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap-dag.c,v 1.36 2008-02-02 20:42:35 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -538,7 +538,7 @@ dag_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) /* Only count packets that pass the filter, for consistency with standard Linux behaviour. */ processed++; - if (processed == cnt) + if (processed == cnt && cnt > 0) { /* Reached the user-specified limit. */ return cnt;