Re: [PATCH] More coverity findings addressed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/27/2012 12:34 PM, Stefan Berger wrote:
> More bug extermination in the category of:
> 
> Error: CHECKED_RETURN:
> 
> 

> One note about the error in commandtest line 809: setsid() seems to fail
> when running the test -- could be removed ?

Odd.  I think we had to add it to make the test pass under some
situations, so I don't think we can remove it, but I'd have to research
why it is failing in other situations.  It may stem from the history of
whether the test is being run from another session leader process, and
that may differ according to whether make is running the test or you are
doing it by hand.

>      if (strlen(service) > DNS_RECORD_LENGTH_SRV) {
> -        char *name = NULL;
> -
> -        virAsprintf(&name, _("Service name is too long, limit is %d
> bytes"), DNS_RECORD_LENGTH_SRV);
>          virNetworkReportError(VIR_ERR_XML_DETAIL,
> -                              "%s", name);
> -        VIR_FREE(name);
> +                              _("Service name is too long, limit is %d
> bytes"),
> +                              DNS_RECORD_LENGTH_SRV);

Nice removal of an extra malloc.

>          goto error;
>      }
> 
> Index: libvirt-acl/src/qemu/qemu_process.c
> ===================================================================
> --- libvirt-acl.orig/src/qemu/qemu_process.c
> +++ libvirt-acl/src/qemu/qemu_process.c
> @@ -2777,8 +2777,8 @@ qemuProcessUpdateState(struct qemud_driv
>          } else {
>              newState = VIR_DOMAIN_PAUSED;
>              newReason = reason;
> -            virAsprintf(&msg, "was paused (%s)",
> -                        virDomainPausedReasonTypeToString(reason));
> +            ignore_value(virAsprintf(&msg, "was paused (%s)",
> +                                
> virDomainPausedReasonTypeToString(reason)));

Safe, since we check msg for NULL later.

> +++ libvirt-acl/tests/commandtest.c
> @@ -806,7 +806,7 @@ mymain(void)
>          return EXIT_FAILURE;
> 
>      setpgid(0, 0);
> -    setsid();
> +    ignore_value(setsid());

Maybe worth logging a warning if we see the failure, but since this is
test code, I'm also okay if we just ignore it (as long as the test still
passes, of course).

ACK.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]