[libvirt] [PATCH 1/3] util: Remove unnecessary check in virFileRewrite

John Ferlan jferlan at redhat.com
Thu Nov 14 21:58:06 UTC 2019


Since g_strdup_printf will abort, we know @newfile won't be NULL.

Found by Coverity

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/util/virfile.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/util/virfile.c b/src/util/virfile.c
index cb6cfc0fe7..fca7ff9d35 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -543,8 +543,7 @@ virFileRewrite(const char *path,
 
  cleanup:
     VIR_FORCE_CLOSE(fd);
-    if (newfile)
-        unlink(newfile);
+    unlink(newfile);
     return ret;
 }
 
-- 
2.20.1




More information about the libvir-list mailing list