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

John Ferlan jferlan at redhat.com
Tue Jan 12 16:22:30 UTC 2016



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




More information about the libvir-list mailing list