From: Wesley Shields Date: Thu, 28 Mar 2013 02:28:11 +0000 (-0400) Subject: Stop reading multiple files properly on cleanup. X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/b33cc013eedfa524c40340c3bc0eba2f9459b8ac Stop reading multiple files properly on cleanup. 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. --- diff --git a/tcpdump.c b/tcpdump.c index 66d81bbf..68cbc719 100644 --- 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.