]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
nwfilter: use g_strdup instead of VIR_STRDUP
authorJán Tomko <jtomko@redhat.com>
Sun, 20 Oct 2019 11:49:46 +0000 (13:49 +0200)
committerJán Tomko <jtomko@redhat.com>
Mon, 21 Oct 2019 10:51:57 +0000 (12:51 +0200)
Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/nwfilter/nwfilter_dhcpsnoop.c
src/nwfilter/nwfilter_driver.c

index 2c7a1a1522064a16d635b95af40c453455fa4b94..bf25345e2ca7f1214dab362489fa439ad2674193 100644 (file)
@@ -1093,8 +1093,7 @@ virNWFilterSnoopDHCPOpen(const char *ifname, virMacAddr *mac,
          * generate much more traffic than if we filtered by VM and
          * braodcast MAC as well
          */
-        if (VIR_STRDUP(ext_filter, filter) < 0)
-            return NULL;
+        ext_filter = g_strdup(filter);
     }
 
     handle = pcap_create(ifname, pcap_errbuf);
index fbdf250934d76e9dc7a318fb2fac970e21a7a4dc..41e0a1d5d9a8313e53f90c005888a08e860d234f 100644 (file)
@@ -205,8 +205,7 @@ nwfilterStateInitialize(bool privileged,
 
     nwfilterDriverLock();
 
-    if (VIR_STRDUP(driver->stateDir, RUNSTATEDIR "/libvirt/nwfilter") < 0)
-        goto error;
+    driver->stateDir = g_strdup(RUNSTATEDIR "/libvirt/nwfilter");
 
     if (virFileMakePathWithMode(driver->stateDir, S_IRWXU) < 0) {
         virReportSystemError(errno, _("cannot create state directory '%s'"),
@@ -252,8 +251,7 @@ nwfilterStateInitialize(bool privileged,
         goto error;
     }
 
-    if (VIR_STRDUP(driver->configDir, SYSCONFDIR "/libvirt/nwfilter") < 0)
-        goto error;
+    driver->configDir = g_strdup(SYSCONFDIR "/libvirt/nwfilter");
 
     if (virFileMakePathWithMode(driver->configDir, S_IRWXU) < 0) {
         virReportSystemError(errno, _("cannot create config directory '%s'"),
@@ -261,8 +259,7 @@ nwfilterStateInitialize(bool privileged,
         goto error;
     }
 
-    if (VIR_STRDUP(driver->bindingDir, RUNSTATEDIR "/libvirt/nwfilter-binding") < 0)
-        goto error;
+    driver->bindingDir = g_strdup(RUNSTATEDIR "/libvirt/nwfilter-binding");
 
     if (virFileMakePathWithMode(driver->bindingDir, S_IRWXU) < 0) {
         virReportSystemError(errno, _("cannot create config directory '%s'"),