]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: Remove unnecessary check in virFileRewrite
authorJohn Ferlan <jferlan@redhat.com>
Tue, 12 Nov 2019 21:10:12 +0000 (16:10 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 19 Nov 2019 12:01:32 +0000 (07:01 -0500)
Since g_strdup_printf will abort, we know @newfile won't be NULL.

Found by Coverity

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
src/util/virfile.c

index cb6cfc0fe72f610c096d51b85482eba8b8c2d5fe..fca7ff9d35e3bdf5f8dabedcace9c62e192874d2 100644 (file)
@@ -543,8 +543,7 @@ virFileRewrite(const char *path,
 
  cleanup:
     VIR_FORCE_CLOSE(fd);
-    if (newfile)
-        unlink(newfile);
+    unlink(newfile);
     return ret;
 }