1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 07:59:00 +00:00

util: replace g_snprintf with g_autofreed g_strdup_printf in viriptables.c

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Laine Stump 2022-03-13 14:21:02 -04:00
parent b7b949d30c
commit cd23bf182c

View File

@ -163,10 +163,7 @@ iptablesInput(virFirewall *fw,
int action,
int tcp)
{
char portstr[32];
g_snprintf(portstr, sizeof(portstr), "%d", port);
portstr[sizeof(portstr) - 1] = '\0';
g_autofree char *portstr = g_strdup_printf("%d", port);
virFirewallAddRule(fw, layer,
"--table", "filter",
@ -187,10 +184,7 @@ iptablesOutput(virFirewall *fw,
int action,
int tcp)
{
char portstr[32];
g_snprintf(portstr, sizeof(portstr), "%d", port);
portstr[sizeof(portstr) - 1] = '\0';
g_autofree char *portstr = g_strdup_printf("%d", port);
virFirewallAddRule(fw, layer,
"--table", "filter",
@ -1028,10 +1022,7 @@ iptablesOutputFixUdpChecksum(virFirewall *fw,
int port,
int action)
{
char portstr[32];
g_snprintf(portstr, sizeof(portstr), "%d", port);
portstr[sizeof(portstr) - 1] = '\0';
g_autofree char *portstr = g_strdup_printf("%d", port);
virFirewallAddRule(fw, VIR_FIREWALL_LAYER_IPV4,
"--table", "mangle",