[ovs-dev] [PATCH] netdev-vport: Do not log empty warnings on success.
Ben Pfaff
blp at ovn.org
Thu Jan 12 17:33:39 UTC 2017
On Thu, Jan 12, 2017 at 12:23:55AM -0800, Daniele Di Proietto wrote:
> set_tunnel_config() always logs a warning, even on success. This
> shouldn't happen.
>
> Without this, some unit tests fail.
>
> Fixes: 9fff138ec3a6("netdev: Add 'errp' to set_config().")
> Signed-off-by: Daniele Di Proietto <diproiettod at vmware.com>
> ---
> lib/netdev-vport.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
> index ad5ffcc81..2db51df72 100644
> --- a/lib/netdev-vport.c
> +++ b/lib/netdev-vport.c
> @@ -561,10 +561,12 @@ set_tunnel_config(struct netdev *dev_, const struct smap *args, char **errp)
> err = 0;
>
> out:
> - ds_chomp(&errors, '\n');
> - VLOG_WARN("%s", ds_cstr(&errors));
> - if (err) {
> - *errp = ds_steal_cstr(&errors);
> + if (*ds_cstr(&errors)) {
How about "if (errors.length)" instead?
> + ds_chomp(&errors, '\n');
> + VLOG_WARN("%s", ds_cstr(&errors));
> + if (err) {
> + *errp = ds_steal_cstr(&errors);
> + }
> }
>
> ds_destroy(&errors);
Acked-by: Ben Pfaff <blp at ovn.org>
More information about the dev
mailing list