Bug fix: Running tshark with the following command will leave a temp file on the...
authorAnders Broman <anders.broman@ericsson.com>
Fri, 5 Nov 2010 15:01:05 +0000 (15:01 -0000)
committerAnders Broman <anders.broman@ericsson.com>
Fri, 5 Nov 2010 15:01:05 +0000 (15:01 -0000)
\tshark -f "port 53" -a duration:1 -z proto,col info,dns.qry.type,dns.qry.type

svn path=/trunk/; revision=34791

tshark.c

index fdf429ba2abd011bebf1438c46bf7e76ee512d06..155970a2946f4c1c987aeaa9e5b062567e7b7fb2 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -65,6 +65,7 @@
 #include <epan/epan.h>
 #include <epan/filesystem.h>
 #include <wsutil/privileges.h>
+#include <wsutil/file_util.h>
 
 #include "globals.h"
 #include <epan/timestamp.h>
@@ -2081,7 +2082,6 @@ capture_input_new_file(capture_options *capture_opts, gchar *new_file)
   gboolean is_tempfile;
   int  err;
 
-
   if(capture_opts->state == CAPTURE_PREPARING) {
     g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture started!");
   }
@@ -2271,6 +2271,9 @@ capture_input_closed(capture_options *capture_opts, gchar *msg)
 
   if(capture_opts->cf != NULL && ((capture_file *) capture_opts->cf)->wth != NULL) {
     wtap_close(((capture_file *) capture_opts->cf)->wth);
+       if(((capture_file *) capture_opts->cf)->user_saved == FALSE){
+               ws_unlink(((capture_file *) capture_opts->cf)->filename);
+       }
   }
 #ifdef USE_BROKEN_G_MAIN_LOOP
   /*g_main_loop_quit(loop);*/