Make sure we call wtap_cleareof() before each read.
authorgerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 16 Jul 2010 18:20:32 +0000 (18:20 +0000)
committergerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 16 Jul 2010 18:20:32 +0000 (18:20 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@33555 f5534014-38df-0310-8fa8-9805f1628bb7

file.c
tshark.c

diff --git a/file.c b/file.c
index 1c5519f379eb202f5bd330265509ed4ce2ab8490..c3ca81dcc29d119756350b6880e0d5648ce165d9 100644 (file)
--- a/file.c
+++ b/file.c
@@ -800,8 +800,11 @@ cf_continue_tail(capture_file *cf, volatile int to_read, int *err)
 
   /*g_log(NULL, G_LOG_LEVEL_MESSAGE, "cf_continue_tail: %u new: %u", cf->count, to_read);*/
 
-  wtap_cleareof(cf->wth);
-  while (to_read != 0 && (wtap_read(cf->wth, err, &err_info, &data_offset))) {
+  while (to_read != 0) {
+    wtap_cleareof(cf->wth);
+    if (!wtap_read(cf->wth, err, &err_info, &data_offset)) {
+      break;
+    }
     if (cf->state == FILE_READ_ABORTED) {
       /* Well, the user decided to exit Wireshark.  Break out of the
          loop, and let the code below (which is called even if there
index a4d0ad1ef1fbe253756962a57f6b23e22b62610a..5c63d2c7ef99c418ef78f87b4b2d11f6a336ab00 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -2159,8 +2159,8 @@ capture_input_new_packets(capture_options *capture_opts, int to_read)
   tap_flags = union_of_tap_listener_flags();
 
   if(do_dissection) {
-    wtap_cleareof(cf->wth);
     while (to_read-- && cf->wth) {
+      wtap_cleareof(cf->wth);
       ret = wtap_read(cf->wth, &err, &err_info, &data_offset);
       if(ret == FALSE) {
         /* read from file failed, tell the capture child to stop */