[PATCH 09/75] interface: Drop virAsprintf() and virAsprintfQuiet() retval checking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/interface/interface_backend_netcf.c |  7 ++-----
 src/interface/interface_backend_udev.c  | 14 ++++----------
 2 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c
index 27590af134..170361e761 100644
--- a/src/interface/interface_backend_netcf.c
+++ b/src/interface/interface_backend_netcf.c
@@ -101,16 +101,13 @@ netcfStateInitialize(bool privileged,
     driver->privileged = privileged;
 
     if (privileged) {
-        if (virAsprintf(&driver->stateDir,
-                        "%s/libvirt/interface", RUNSTATEDIR) < 0)
-            goto error;
+        virAsprintf(&driver->stateDir, "%s/libvirt/interface", RUNSTATEDIR);
     } else {
         g_autofree char *rundir = NULL;
 
         if (!(rundir = virGetUserRuntimeDirectory()))
             goto error;
-        if (virAsprintf(&driver->stateDir, "%s/interface/run", rundir) < 0)
-            goto error;
+        virAsprintf(&driver->stateDir, "%s/interface/run", rundir);
     }
 
     if (virFileMakePathWithMode(driver->stateDir, S_IRWXU) < 0) {
diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
index 251c2ecdf0..a906756830 100644
--- a/src/interface/interface_backend_udev.c
+++ b/src/interface/interface_backend_udev.c
@@ -856,9 +856,7 @@ udevGetIfaceDefBridge(struct udev *udev,
     }
 
     /* Members of the bridge */
-    if (virAsprintf(&member_path, "%s/%s",
-                udev_device_get_syspath(dev), "brif") < 0)
-        goto error;
+    virAsprintf(&member_path, "%s/%s", udev_device_get_syspath(dev), "brif");
 
     /* Get each member of the bridge */
     member_count = scandir(member_path, &member_list,
@@ -920,8 +918,7 @@ udevGetIfaceDefVlan(struct udev *udev G_GNUC_UNUSED,
     const char *dev_prefix = "\nDevice: ";
     int ret = -1;
 
-    if (virAsprintf(&procpath, "/proc/net/vlan/%s", name) < 0)
-        goto cleanup;
+    virAsprintf(&procpath, "/proc/net/vlan/%s", name);
 
     if (virFileReadAll(procpath, BUFSIZ, &buf) < 0)
         goto cleanup;
@@ -1164,16 +1161,13 @@ udevStateInitialize(bool privileged,
     driver->lockFD = -1;
 
     if (privileged) {
-        if (virAsprintf(&driver->stateDir,
-                        "%s/libvirt/interface", RUNSTATEDIR) < 0)
-            goto cleanup;
+        virAsprintf(&driver->stateDir, "%s/libvirt/interface", RUNSTATEDIR);
     } else {
         g_autofree char *rundir = NULL;
 
         if (!(rundir = virGetUserRuntimeDirectory()))
             goto cleanup;
-        if (virAsprintf(&driver->stateDir, "%s/interface/run", rundir) < 0)
-            goto cleanup;
+        virAsprintf(&driver->stateDir, "%s/interface/run", rundir);
     }
 
     if (virFileMakePathWithMode(driver->stateDir, S_IRWXU) < 0) {
-- 
2.21.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux