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

Cole Robinson crobinso at redhat.com
Tue Jan 12 16:04:45 UTC 2016


- 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;
         }
-- 
2.5.0




More information about the libvir-list mailing list