[ovs-dev] [arp-rw 04/13] pcap-file: Improve error logging.
Alex Wang
alexw at nicira.com
Tue Oct 8 21:00:11 UTC 2013
Looks good to me, thx
On Mon, Sep 23, 2013 at 10:49 AM, Ben Pfaff <blp at nicira.com> wrote:
> 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 at 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 at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20131008/e270f1e1/attachment-0003.html>
More information about the dev
mailing list