Re: [PATCH] testutils: Fix coverity warning with REGENERATE_OUTPUT

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

 




On 01/12/2016 11:04 AM, Cole Robinson wrote:
> - Don't double check for expectName
> - actual is always non-NULL by this point, so don't check it either
> ---
>  tests/testutils.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/testutils.c b/tests/testutils.c
> index 4ffea0c..b587f83 100644
> --- a/tests/testutils.c
> +++ b/tests/testutils.c
> @@ -469,15 +469,14 @@ virtTestDifferenceFullInternal(FILE *stream,
>      actualStart = actual;
>      actualEnd = actual + (strlen(actual)-1);
>  
> -    if (regenerate && (virTestGetRegenerate() > 0) && expectName && actual) {
> +    if (expectName && regenerate && (virTestGetRegenerate() > 0)) {
>          char *regencontent;
>  
>          /* Try to properly indent qemu argv files */
>          if (!(regencontent = virStringReplace(actual, " -", " \\\n-")))
>              return -1;
>  
> -        if (expectName && actual &&
> -            virFileWriteStr(expectName, regencontent, 0666) < 0) {
> +        if (virFileWriteStr(expectName, regencontent, 0666) < 0) {
>              VIR_FREE(regencontent);
>              return -1;
>          }
> 

Double ACK ;-)... it resolves coverity issue too.

John

--
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]