[libvirt] [PATCH] macvtap: Fix error return values to -1 instead of 1

Stefan Berger stefanb at linux.vnet.ibm.com
Mon Oct 24 18:14:11 UTC 2011


On 10/20/2011 01:46 PM, Roopa Prabhu wrote:
> From: Roopa Prabhu<roprabhu at cisco.com>
>
> Fixes some cases where 1 was being returned instead of -1.
> There are still some inconsistencies in the file with respect
> to what the return variable is initialized to. Can be fixed
> as a separate patch if needed. The scope of this patch is just
> to fix the return value 1. Did some basic sanity test.
>
> Signed-off-by: Roopa Prabhu<roprabhu at cisco.com>
> Reported-by: Eric Blake<eblake at redhat.com>
> ---
>   src/util/macvtap.c |   22 ++++++++--------------
>   1 files changed, 8 insertions(+), 14 deletions(-)
>
>
> diff --git a/src/util/macvtap.c b/src/util/macvtap.c
> index 7fd6eb5..f8b9d55 100644
> --- a/src/util/macvtap.c
> +++ b/src/util/macvtap.c
> @@ -480,7 +480,7 @@ getPortProfileStatus(struct nlattr **tb, int32_t vf,
>                        bool is8021Qbg,
>                        uint16_t *status)
>   {
> -    int rc = 1;
> +    int rc = -1;
>       const char *msg = NULL;
>       struct nlattr *tb_port[IFLA_PORT_MAX + 1] = { NULL, };
>
> @@ -806,7 +806,7 @@ doPortProfileOpCommon(bool nltarget_kernel,
>                       _("error %d during port-profile setlink on "
>                         "interface %s (%d)"),
>                       status, ifname, ifindex);
> -            rc = 1;
> +            rc = -1;
>               break;
>           }
>
In this function we later on return a -ETIMEDOUT. The -1 doesn't overlap 
with it, but I am wondering whether we should return -EFAULT in the 
places of -1 now ?

   Stefan




More information about the libvir-list mailing list