aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
diff options
context:
space:
mode:
authorSake Blok <sake@euronet.nl>2008-02-15 13:02:43 +0000
committerSake Blok <sake@euronet.nl>2008-02-15 13:02:43 +0000
commitb38b10b51601e719622fe3e55e3c1fba21a1f8ec (patch)
tree6f8d2a1c60d253aa7cf3ac799ac4ebeaeac83653 /tshark.c
parent0d0d86cc579311cc33884cfbbed98e109bdde3d8 (diff)
Make -c work properly in tshark when a read filter is used.
svn path=/trunk/; revision=24335
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/tshark.c b/tshark.c
index 0d9be65244..2e04d4c2b3 100644
--- a/tshark.c
+++ b/tshark.c
@@ -2256,10 +2256,11 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
}
}
/* Stop reading if we have the maximum number of packets;
- * note that a zero max_packet_count will never be matched
- * (unless we roll over the packet number?)
+ * When the -c option has not been used, max_packet_count
+ * starts at 0, which practically means, never stop reading.
+ * (unless we roll over max_packet_count ?)
*/
- if(max_packet_count == cf->count || (max_byte_count != 0 && data_offset >= max_byte_count)) {
+ if( (--max_packet_count == 0) || (max_byte_count != 0 && data_offset >= max_byte_count)) {
err = 0; /* This is not an error */
break;
}