提交 a0bb1369 编写于 作者: J Ján Tomko

nwfilter: use g_strdup instead of VIR_STRDUP

Replace all occurrences of
  if (VIR_STRDUP(a, b) < 0)
     /* effectively dead code */
with:
  a = g_strdup(b);
Signed-off-by: NJán Tomko <jtomko@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 7f1f0453
...@@ -1093,8 +1093,7 @@ virNWFilterSnoopDHCPOpen(const char *ifname, virMacAddr *mac, ...@@ -1093,8 +1093,7 @@ virNWFilterSnoopDHCPOpen(const char *ifname, virMacAddr *mac,
* generate much more traffic than if we filtered by VM and * generate much more traffic than if we filtered by VM and
* braodcast MAC as well * braodcast MAC as well
*/ */
if (VIR_STRDUP(ext_filter, filter) < 0) ext_filter = g_strdup(filter);
return NULL;
} }
handle = pcap_create(ifname, pcap_errbuf); handle = pcap_create(ifname, pcap_errbuf);
......
...@@ -205,8 +205,7 @@ nwfilterStateInitialize(bool privileged, ...@@ -205,8 +205,7 @@ nwfilterStateInitialize(bool privileged,
nwfilterDriverLock(); nwfilterDriverLock();
if (VIR_STRDUP(driver->stateDir, RUNSTATEDIR "/libvirt/nwfilter") < 0) driver->stateDir = g_strdup(RUNSTATEDIR "/libvirt/nwfilter");
goto error;
if (virFileMakePathWithMode(driver->stateDir, S_IRWXU) < 0) { if (virFileMakePathWithMode(driver->stateDir, S_IRWXU) < 0) {
virReportSystemError(errno, _("cannot create state directory '%s'"), virReportSystemError(errno, _("cannot create state directory '%s'"),
...@@ -252,8 +251,7 @@ nwfilterStateInitialize(bool privileged, ...@@ -252,8 +251,7 @@ nwfilterStateInitialize(bool privileged,
goto error; goto error;
} }
if (VIR_STRDUP(driver->configDir, SYSCONFDIR "/libvirt/nwfilter") < 0) driver->configDir = g_strdup(SYSCONFDIR "/libvirt/nwfilter");
goto error;
if (virFileMakePathWithMode(driver->configDir, S_IRWXU) < 0) { if (virFileMakePathWithMode(driver->configDir, S_IRWXU) < 0) {
virReportSystemError(errno, _("cannot create config directory '%s'"), virReportSystemError(errno, _("cannot create config directory '%s'"),
...@@ -261,8 +259,7 @@ nwfilterStateInitialize(bool privileged, ...@@ -261,8 +259,7 @@ nwfilterStateInitialize(bool privileged,
goto error; goto error;
} }
if (VIR_STRDUP(driver->bindingDir, RUNSTATEDIR "/libvirt/nwfilter-binding") < 0) driver->bindingDir = g_strdup(RUNSTATEDIR "/libvirt/nwfilter-binding");
goto error;
if (virFileMakePathWithMode(driver->bindingDir, S_IRWXU) < 0) { if (virFileMakePathWithMode(driver->bindingDir, S_IRWXU) < 0) {
virReportSystemError(errno, _("cannot create config directory '%s'"), virReportSystemError(errno, _("cannot create config directory '%s'"),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册