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".
This commit is contained in:
parent
d46f258195
commit
43b6c2d818
|
@ -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;
|
||||
|
|
Reference in New Issue