[libvirt PATCH 2/2] tests: Minimize variable scope

Andrea Bolognani abologna at redhat.com
Tue Jul 14 20:33:00 UTC 2020


Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 tests/virnetsockettest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index f56e623cb3..96c582216c 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -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;
 
-- 
2.25.4




More information about the libvir-list mailing list