]> The Tcpdump Group git mirrors - tcpdump/commitdiff
From Phil Wood <[email protected]>: if we're exiting due to a "pcap_loop()"
authorguy <guy>
Thu, 16 May 2002 10:25:58 +0000 (10:25 +0000)
committerguy <guy>
Thu, 16 May 2002 10:25:58 +0000 (10:25 +0000)
error, report statistics and clean up first.

CREDITS
tcpdump.c

diff --git a/CREDITS b/CREDITS
index df090e77b2c630af81dc0f29245be9f0304e5c1e..af8a68adcb31b3311252f52d28e0f25225cc08c1 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -73,6 +73,7 @@ Additional people who have contributed patches:
        Pasvorn Boonmark                <[email protected]>
        Pekka Savola                    <[email protected]>     
        Peter Jeremy                    <[email protected]>
+       Phil Wood                       <[email protected]>
        Rafal Maszkowski                <[email protected]>
        Rick Jones                      <[email protected]>
        Roderick Schertler              <[email protected]>
index 6e1c018772f0b83bce1559ab7ebbdd3ab82cb5f4..294f74b803bcf399eeafb2426ab1bb83a341d8cd 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -30,7 +30,7 @@ static const char copyright[] =
     "@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000\n\
 The Regents of the University of California.  All rights reserved.\n";
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.175 2002-04-24 06:55:56 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.176 2002-05-16 10:25:58 guy Exp $ (LBL)";
 #endif
 
 /*
@@ -494,6 +494,8 @@ main(int argc, char **argv)
        if (pcap_loop(pd, cnt, printer, pcap_userdata) < 0) {
                (void)fprintf(stderr, "%s: pcap_loop: %s\n",
                    program_name, pcap_geterr(pd));
+               cleanup(0);
+               pcap_close(pd);
                exit(1);
        }
        if (RFileName == NULL)
@@ -513,7 +515,8 @@ cleanup(int signo)
                putc('\n', stderr);
                info(1);
        }
-       exit(0);
+       if (signo)
+               exit(0);
 }
 
 void