From 43b6c2d818975c0515036b69e9f83c5574b47dbc Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 2 Feb 2008 20:42:35 +0000 Subject: [PATCH] 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". --- pcap-dag.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pcap-dag.c b/pcap-dag.c index f53fe23..207f5f3 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;