2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00

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 <blp@nicira.com>
This commit is contained in:
Ben Pfaff
2013-09-23 10:14:35 -07:00
parent de80e4b65b
commit f6cdbd3e32

View File

@@ -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. */