]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
iptablesPrivateChainCreate: Remove superfluous `goto`s
authorTim Wiederhake <twiederh@redhat.com>
Mon, 5 Jul 2021 13:46:54 +0000 (15:46 +0200)
committerTim Wiederhake <twiederh@redhat.com>
Wed, 14 Jul 2021 13:36:27 +0000 (15:36 +0200)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/util/viriptables.c

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