[libvirt] [PATCH 03/75] access: Drop virAsprintf() and virAsprintfQuiet() retval checking

Daniel P. Berrangé berrange at redhat.com
Tue Oct 22 14:09:13 UTC 2019


On Tue, Oct 22, 2019 at 03:57:07PM +0200, Michal Privoznik wrote:
> These functions can't fail really. Drop checking of their retval
> then.

These are declared G_GNUC_WARN_UNUSED_RESULT so this will surely
result in a broken build when bisecting.

When I added the abort-on-OOM logic I intentionally left the
G_GNUC_WARN_UNUSED_RESULT annotation in place, as I didn't
want us to go through the step of dropping the return value
checking, instead wanting to go straight to g_strdup_printf
in one go to reduce the number of patches.

With this in mind, IMHO the first half of this series is redundant
and each patch should be squashed into the corresponding patch in
the second half of this series.

> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/access/viraccessdriverpolkit.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/access/viraccessdriverpolkit.c b/src/access/viraccessdriverpolkit.c
> index 496210fabe..5d6c4204ff 100644
> --- a/src/access/viraccessdriverpolkit.c
> +++ b/src/access/viraccessdriverpolkit.c
> @@ -59,10 +59,8 @@ virAccessDriverPolkitFormatAction(const char *typename,
>      char *actionid = NULL;
>      size_t i;
>  
> -    if (virAsprintf(&actionid, "%s.%s.%s",
> -                    VIR_ACCESS_DRIVER_POLKIT_ACTION_PREFIX,
> -                    typename, permname) < 0)
> -        return NULL;
> +    virAsprintf(&actionid, "%s.%s.%s", VIR_ACCESS_DRIVER_POLKIT_ACTION_PREFIX,
> +                typename, permname);
>  
>      for (i = 0; actionid[i]; i++)
>          if (actionid[i] == '_')
> -- 
> 2.21.0
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list