]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Stop reading multiple files properly on cleanup.
authorWesley Shields <[email protected]>
Thu, 28 Mar 2013 02:28:11 +0000 (22:28 -0400)
committerGuy Harris <[email protected]>
Fri, 29 Mar 2013 10:28:48 +0000 (03:28 -0700)
Prior to this if pcap_breakloop() is called in cleanup() while reading
multiple files (via -V) the code would fall through and open the next
file in the list. With this change the list is cut short and the program
exits normally.

tcpdump.c

index 66d81bbf4f607bde784d8a770d09fea94d723954..68cbc719c668595f19d358491667cda98d465ccb 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -1545,6 +1545,14 @@ main(int argc, char **argv)
                        }
                        (void)fflush(stdout);
                }
+                if (status == -2) {
+                       /*
+                        * We got interrupted. If we are reading multiple
+                        * files (via -V) set these so that we stop.
+                        */
+                       VFileName = NULL;
+                       ret = NULL;
+               }
                if (status == -1) {
                        /*
                         * Error.  Report it.