diff options
author | Ben Pfaff <blp@nicira.com> | 2013-09-23 10:14:35 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2013-10-09 17:02:57 -0700 |
commit | f6cdbd3e327a38cf4a61a7ad2fc107e521eee957 (patch) | |
tree | bee9fa7f57d327812a7897d7436896a26845c420 /lib/pcap-file.c | |
parent | de80e4b65ba14c8d21b537470678fe0562ca79a8 (diff) |
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>
Diffstat (limited to 'lib/pcap-file.c')
-rw-r--r-- | lib/pcap-file.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/pcap-file.c b/lib/pcap-file.c index d137be81..d181a3ed 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. */ |