mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
nwfilter: Use g_strdup_printf() instead of virAsprintf()
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
7847f011b0
commit
c09b0fe7a7
@ -315,8 +315,7 @@ virNWFilterSnoopActivate(virNWFilterSnoopReqPtr req)
|
|||||||
{
|
{
|
||||||
char *key;
|
char *key;
|
||||||
|
|
||||||
if (virAsprintf(&key, "%p-%d", req, req->ifindex) < 0)
|
key = g_strdup_printf("%p-%d", req, req->ifindex);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
virNWFilterSnoopActiveLock();
|
virNWFilterSnoopActiveLock();
|
||||||
|
|
||||||
@ -1081,9 +1080,7 @@ virNWFilterSnoopDHCPOpen(const char *ifname, virMacAddr *mac,
|
|||||||
* extend the filter with the macaddr of the VM; filter the
|
* extend the filter with the macaddr of the VM; filter the
|
||||||
* more unlikely parameters first, then go for the MAC
|
* more unlikely parameters first, then go for the MAC
|
||||||
*/
|
*/
|
||||||
if (virAsprintf(&ext_filter,
|
ext_filter = g_strdup_printf("%s and ether src %s", filter, macaddr);
|
||||||
"%s and ether src %s", filter, macaddr) < 0)
|
|
||||||
return NULL;
|
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Some DHCP servers respond via MAC broadcast; we rely on later
|
* 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 */
|
/* time intf ip dhcpserver */
|
||||||
if (virAsprintf(&lbuf, "%u %s %s %s\n", ipl->timeout,
|
lbuf = g_strdup_printf("%u %s %s %s\n", ipl->timeout, ifkey, ipstr, dhcpstr);
|
||||||
ifkey, ipstr, dhcpstr) < 0) {
|
|
||||||
ret = -1;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
len = strlen(lbuf);
|
len = strlen(lbuf);
|
||||||
|
|
||||||
if (safewrite(lfd, lbuf, len) != len) {
|
if (safewrite(lfd, lbuf, len) != len) {
|
||||||
|
Loading…
Reference in New Issue
Block a user