There is no reason to log end of file as an error, but that's what this
code was doing.

Signed-off-by: Ben Pfaff <b...@nicira.com>
---
 lib/pcap-file.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/pcap-file.c b/lib/pcap-file.c
index d137be8..d181a3e 100644
--- a/lib/pcap-file.c
+++ b/lib/pcap-file.c
@@ -114,10 +114,14 @@ pcap_read(FILE *file, struct ofpbuf **bufp)
 
     /* Read header. */
     if (fread(&prh, sizeof prh, 1, file) != 1) {
-        int error = ferror(file) ? errno : EOF;
-        VLOG_WARN("failed to read pcap record header: %s",
-                  ovs_retval_to_string(error));
-        return error;
+        if (ferror(file)) {
+            int error = errno;
+            VLOG_WARN("failed to read pcap record header: %s",
+                      ovs_retval_to_string(error));
+            return error;
+        } else {
+            return EOF;
+        }
     }
 
     /* Calculate length. */
-- 
1.7.10.4

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to