From: zolf Date: Sun, 5 Jan 2014 21:28:54 +0000 (+0100) Subject: reset the counter after a -G rollover (GH #352) X-Git-Tag: tcpdump-4.6.0~292 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/cd69580087f110c27358248bc3100f915838e4d4 reset the counter after a -G rollover (GH #352) when -G -C is used the filename counter continued. Changed the behaviour so that when -G is rolled over to the next file the Cflag-counter is reset to 0 so that the filenames will restart counting. --- diff --git a/tcpdump.c b/tcpdump.c index 9834a51e..da040280 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -1847,6 +1847,13 @@ dump_packet_and_trunc(u_char *user, const struct pcap_pkthdr *h, const u_char *s dump_info->CurrentFileName = (char *)malloc(PATH_MAX + 1); if (dump_info->CurrentFileName == NULL) error("dump_packet_and_trunc: malloc"); + /* + * Gflag was set otherwise we wouldn't be here. Reset the count + * so multiple files would end with 1,2,3 in the filename. + * The counting is handled with the -C flow after this. + */ + Cflag_count = 0; + /* * This is always the first file in the Cflag * rotation: e.g. 0