aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
diff options
context:
space:
mode:
authorsake <sake@f5534014-38df-0310-8fa8-9805f1628bb7>2008-02-15 13:02:43 +0000
committersake <sake@f5534014-38df-0310-8fa8-9805f1628bb7>2008-02-15 13:02:43 +0000
commite0cd61b24e083f9578a1181c98d65b1c3f2feec9 (patch)
tree6f8d2a1c60d253aa7cf3ac799ac4ebeaeac83653 /tshark.c
parent673fc2c27bc2129664b4d49c8cc2a7266c2d07de (diff)
Make -c work properly in tshark when a read filter is used.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24335 f5534014-38df-0310-8fa8-9805f1628bb7
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;
}