From: Ben Pfaff Date: Mon, 23 Sep 2013 17:14:35 +0000 (-0700) Subject: pcap-file: Improve error logging. X-Git-Tag: sliver-openvswitch-2.0.90-1~8^2~18 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=f6cdbd3e327a38cf4a61a7ad2fc107e521eee957;p=sliver-openvswitch.git pcap-file: Improve error logging. 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 --- diff --git a/lib/pcap-file.c b/lib/pcap-file.c index d137be81f..d181a3ed4 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. */