[ovs-dev] [coverity 10/12] unixctl: Use ovs_retval_to_string() where EOF is a possible value.

Ethan Jackson ethan at nicira.com
Fri Feb 1 21:58:02 UTC 2013


Acked-by: Ethan Jackson <ethan at nicira.com>

On Thu, Jan 24, 2013 at 2:44 PM, Ben Pfaff <blp at nicira.com> wrote:
> jsonrpc_transact_block() might return EOF so passing its return value to
> strerror() isn't general enough.
>
> It might be better to change jsonrpc_transact{_block}() to never return
> EOF, since a closed connection seems like it is always an error in that
> context.
>
> Found by Coverity.
>
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
>  lib/unixctl.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/unixctl.c b/lib/unixctl.c
> index e59056e..104a2d9 100644
> --- a/lib/unixctl.c
> +++ b/lib/unixctl.c
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
> + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
>   *
>   * Licensed under the Apache License, Version 2.0 (the "License");
>   * you may not use this file except in compliance with the License.
> @@ -462,7 +462,7 @@ unixctl_client_transact(struct jsonrpc *client, const char *command, int argc,
>      error = jsonrpc_transact_block(client, request, &reply);
>      if (error) {
>          VLOG_WARN("error communicating with %s: %s", jsonrpc_get_name(client),
> -                  strerror(error));
> +                  ovs_retval_to_string(error));
>          return error;
>      }
>
> --
> 1.7.2.5
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list