]> xenbits.xensource.com Git - libvirt.git/commitdiff
virhook: do not save the return value of virBuildPath
authorJán Tomko <jtomko@redhat.com>
Wed, 10 Feb 2016 15:30:38 +0000 (16:30 +0100)
committerJán Tomko <jtomko@redhat.com>
Thu, 11 Feb 2016 07:05:17 +0000 (08:05 +0100)
This function returns -1 on allocation error, there's no
need to check the path for NULL again.

src/util/virhook.c

index ee19382c4a6e655427f3a9f6898fd88e8ac42966..ba505984ec9f89dfc3432d21e32227503f5acee4 100644 (file)
@@ -119,8 +119,7 @@ virHookCheck(int no, const char *driver)
         return -1;
     }
 
-    ret = virBuildPath(&path, LIBVIRT_HOOK_DIR, driver);
-    if ((ret < 0) || (path == NULL)) {
+    if (virBuildPath(&path, LIBVIRT_HOOK_DIR, driver) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Failed to build path for %s hook"),
                        driver);
@@ -276,8 +275,7 @@ virHookCall(int driver,
     if (extra == NULL)
         extra = "-";
 
-    ret = virBuildPath(&path, LIBVIRT_HOOK_DIR, drvstr);
-    if ((ret < 0) || (path == NULL)) {
+    if (virBuildPath(&path, LIBVIRT_HOOK_DIR, drvstr) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Failed to build path for %s hook"),
                        drvstr);