]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: Minimize variable scope
authorAndrea Bolognani <abologna@redhat.com>
Tue, 14 Jul 2020 19:52:10 +0000 (21:52 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Wed, 15 Jul 2020 10:52:24 +0000 (12:52 +0200)
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tests/virnetsockettest.c

index f56e623cb3d61819ddb1f2dcfc68c7b93860f382..96c582216cea20dcfd4bc1e21f3cf974725e02ab 100644 (file)
@@ -55,13 +55,14 @@ checkProtocols(bool *hasIPv4, bool *hasIPv6,
         return -1;
 
     for (i = 0; i < 50; i++) {
-        int only = 1;
         if (*hasIPv4) {
             if ((s4 = socket(AF_INET, SOCK_STREAM, 0)) < 0)
                 goto cleanup;
         }
 
         if (*hasIPv6) {
+            int only = 1;
+
             if ((s6 = socket(AF_INET6, SOCK_STREAM, 0)) < 0)
                 goto cleanup;