From a0bb1369295347466eb6d2f6b01310fbe50cbc1b Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A1n=20Tomko?= Date: Sun, 20 Oct 2019 13:49:46 +0200 Subject: [PATCH] nwfilter: use g_strdup instead of VIR_STRDUP MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Replace all occurrences of if (VIR_STRDUP(a, b) < 0) /* effectively dead code */ with: a = g_strdup(b); Signed-off-by: Ján Tomko Reviewed-by: Michal Privoznik --- src/nwfilter/nwfilter_dhcpsnoop.c | 3 +-- src/nwfilter/nwfilter_driver.c | 9 +++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c index 2c7a1a1522..bf25345e2c 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -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); diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index fbdf250934..41e0a1d5d9 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -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'"), -- 2.47.2