1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-21 22:03:49 +03:00

iptablesPrivateChainCreate: Remove superfluous gotos

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Tim Wiederhake 2021-07-05 15:46:54 +02:00
parent 534874f705
commit 78f47cba9b

View File

@ -73,14 +73,13 @@ iptablesPrivateChainCreate(virFirewall *fw,
g_autoptr(GHashTable) chains = virHashNew(NULL); g_autoptr(GHashTable) chains = virHashNew(NULL);
g_autoptr(GHashTable) links = virHashNew(NULL); g_autoptr(GHashTable) links = virHashNew(NULL);
const char *const *tmp; const char *const *tmp;
int ret = -1;
size_t i; size_t i;
tmp = lines; tmp = lines;
while (tmp && *tmp) { while (tmp && *tmp) {
if (STRPREFIX(*tmp, "-N ")) { /* eg "-N LIBVIRT_INP" */ if (STRPREFIX(*tmp, "-N ")) { /* eg "-N LIBVIRT_INP" */
if (virHashUpdateEntry(chains, *tmp + 3, (void *)0x1) < 0) if (virHashUpdateEntry(chains, *tmp + 3, (void *)0x1) < 0)
goto cleanup; return -1;
} else if (STRPREFIX(*tmp, "-A ")) { /* eg "-A INPUT -j LIBVIRT_INP" */ } else if (STRPREFIX(*tmp, "-A ")) { /* eg "-A INPUT -j LIBVIRT_INP" */
char *sep = strchr(*tmp + 3, ' '); char *sep = strchr(*tmp + 3, ' ');
if (sep) { if (sep) {
@ -88,7 +87,7 @@ iptablesPrivateChainCreate(virFirewall *fw,
if (STRPREFIX(sep + 1, "-j ")) { if (STRPREFIX(sep + 1, "-j ")) {
if (virHashUpdateEntry(links, sep + 4, if (virHashUpdateEntry(links, sep + 4,
(char *)*tmp + 3) < 0) (char *)*tmp + 3) < 0)
goto cleanup; return -1;
} }
} }
} }
@ -112,9 +111,7 @@ iptablesPrivateChainCreate(virFirewall *fw,
"--jump", data->chains[i].child, NULL); "--jump", data->chains[i].child, NULL);
} }
ret = 0; return 0;
cleanup:
return ret;
} }