Minor fix: For "wireshark -Q ..." show "no packets captured" popup only when valid.
authorwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 17 May 2007 01:41:47 +0000 (01:41 +0000)
committerwmeier <wmeier@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 17 May 2007 01:41:47 +0000 (01:41 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@21810 f5534014-38df-0310-8fa8-9805f1628bb7

capture.c

index f412e6c866a6478ea709995529c8ae95d2c0a488..b5f83001b5ad4a68c458be69f18a96efa729de78 100644 (file)
--- a/capture.c
+++ b/capture.c
@@ -455,7 +455,7 @@ void
 capture_input_closed(capture_options *capture_opts)
 {
     int  err;
-
+    int  packet_count_save;
 
     g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture stopped!");
     g_assert(capture_opts->state == CAPTURE_PREPARING || capture_opts->state == CAPTURE_RUNNING);
@@ -471,11 +471,13 @@ capture_input_closed(capture_options *capture_opts)
     }
 
     if(capture_opts->real_time_mode) {
-               cf_read_status_t status;
+       cf_read_status_t status;
 
         /* Read what remains of the capture file. */
         status = cf_finish_tail(capture_opts->cf, &err);
 
+        /* XXX: If -Q (quit-after-cap) then cf->count clr'd below so save it first */
+       packet_count_save = cf_get_packet_count(capture_opts->cf);
         /* Tell the GUI, we are not doing a capture any more.
                   Must be done after the cf_finish_tail(), so file lengths are displayed 
                   correct. */
@@ -485,7 +487,7 @@ capture_input_closed(capture_options *capture_opts)
         switch (status) {
 
         case CF_READ_OK:
-            if(cf_get_packet_count(capture_opts->cf) == 0 && !capture_opts->restart) {
+            if ((packet_count_save == 0) && !capture_opts->restart) {
                 simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK, 
 "%sNo packets captured!%s\n"
 "\n"