[libvirt] [PATCH 04/75] bhyve: Drop virAsprintf() and virAsprintfQuiet() retval checking

Michal Privoznik mprivozn at redhat.com
Tue Oct 22 13:57:08 UTC 2019


These functions can't fail really. Drop checking of their retval
then.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/bhyve/bhyve_capabilities.c |  6 ++----
 src/bhyve/bhyve_process.c      | 16 +++++-----------
 2 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/src/bhyve/bhyve_capabilities.c b/src/bhyve/bhyve_capabilities.c
index 27fa8ee5ef..2f03bd6131 100644
--- a/src/bhyve/bhyve_capabilities.c
+++ b/src/bhyve/bhyve_capabilities.c
@@ -159,10 +159,8 @@ virBhyveDomainCapsBuild(bhyveConnPtr conn,
                 firmwares_alloc, firmwares->nvalues, 1) < 0)
                 goto cleanup;
 
-            if (virAsprintf(
-                    &firmwares->values[firmwares->nvalues],
-                    "%s/%s", firmware_dir, entry->d_name) < 0)
-                goto cleanup;
+            virAsprintf(&firmwares->values[firmwares->nvalues], "%s/%s",
+                        firmware_dir, entry->d_name);
 
             firmwares->nvalues++;
         }
diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index 5193f6e612..17e32176d9 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
@@ -86,11 +86,10 @@ bhyveNetCleanup(virDomainObjPtr vm)
     }
 }
 
-static int
+static void
 virBhyveFormatDevMapFile(const char *vm_name, char **fn_out)
 {
-    return virAsprintf(fn_out, "%s/grub_bhyve-%s-device.map", BHYVE_STATE_DIR,
-                       vm_name);
+    virAsprintf(fn_out, "%s/grub_bhyve-%s-device.map", BHYVE_STATE_DIR, vm_name);
 }
 
 int
@@ -113,9 +112,7 @@ virBhyveProcessStart(virConnectPtr conn,
     int ret = -1, rc;
     virCapsPtr caps = NULL;
 
-    if (virAsprintf(&logfile, "%s/%s.log",
-                    BHYVE_LOG_DIR, vm->def->name) < 0)
-       return -1;
+    virAsprintf(&logfile, "%s/%s.log", BHYVE_LOG_DIR, vm->def->name);
 
     caps = bhyveDriverGetCapabilities(privconn);
     if (!caps)
@@ -165,9 +162,7 @@ virBhyveProcessStart(virConnectPtr conn,
          * domain is ready to be started, so we can build
          * and execute bhyveload command */
 
-        rc = virBhyveFormatDevMapFile(vm->def->name, &devmap_file);
-        if (rc < 0)
-            goto cleanup;
+        virBhyveFormatDevMapFile(vm->def->name, &devmap_file);
 
         if (!(load_cmd = virBhyveProcessBuildLoadCmd(conn, vm->def, devmap_file,
                                                      &devicemap)))
@@ -408,8 +403,7 @@ virBhyveProcessReconnect(virDomainObjPtr vm,
     if (kp == NULL || nprocs != 1)
         goto cleanup;
 
-    if (virAsprintf(&expected_proctitle, "bhyve: %s", vm->def->name) < 0)
-        goto cleanup;
+    virAsprintf(&expected_proctitle, "bhyve: %s", vm->def->name);
 
     proc_argv = kvm_getargv(data->kd, kp, 0);
     if (proc_argv && proc_argv[0]) {
-- 
2.21.0




More information about the libvir-list mailing list