]> The Tcpdump Group git mirrors - libpcap/commitdiff
Explicitly check for a positive "cnt" argument, as at least some other
authorguy <guy>
Sat, 2 Feb 2008 20:42:35 +0000 (20:42 +0000)
committerguy <guy>
Sat, 2 Feb 2008 20:42:35 +0000 (20:42 +0000)
read_op loops do, to clarify that a zero or negative "cnt" value means
"loop until we run out of packets".

pcap-dag.c

index f53fe2370602d160aceb3fe50c7b77f40a46b642..207f5f3c04c4166c5a87b1a5ebfb08e9d0bc729b 100644 (file)
@@ -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;