[PATCH 16/75] nwfilter: 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/nwfilter/nwfilter_dhcpsnoop.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
index 665e7bff9c..b4ce8a0613 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.c
+++ b/src/nwfilter/nwfilter_dhcpsnoop.c
@@ -315,8 +315,7 @@ virNWFilterSnoopActivate(virNWFilterSnoopReqPtr req)
 {
     char *key;
 
-    if (virAsprintf(&key, "%p-%d", req, req->ifindex) < 0)
-        return NULL;
+    virAsprintf(&key, "%p-%d", req, req->ifindex);
 
     virNWFilterSnoopActiveLock();
 
@@ -1081,9 +1080,7 @@ virNWFilterSnoopDHCPOpen(const char *ifname, virMacAddr *mac,
          * extend the filter with the macaddr of the VM; filter the
          * more unlikely parameters first, then go for the MAC
          */
-        if (virAsprintf(&ext_filter,
-                        "%s and ether src %s", filter, macaddr) < 0)
-            return NULL;
+        virAsprintf(&ext_filter, "%s and ether src %s", filter, macaddr);
     } else {
         /*
          * Some DHCP servers respond via MAC broadcast; we rely on later
@@ -1766,11 +1763,7 @@ virNWFilterSnoopLeaseFileWrite(int lfd, const char *ifkey,
     }
 
     /* time intf ip dhcpserver */
-    if (virAsprintf(&lbuf, "%u %s %s %s\n", ipl->timeout,
-                    ifkey, ipstr, dhcpstr) < 0) {
-        ret = -1;
-        goto cleanup;
-    }
+    virAsprintf(&lbuf, "%u %s %s %s\n", ipl->timeout, ifkey, ipstr, dhcpstr);
     len = strlen(lbuf);
 
     if (safewrite(lfd, lbuf, len) != len) {
-- 
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