]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virNetDevOpenvswitchConstructVlans: Bring @i into the block where it's used
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 13 May 2020 09:49:07 +0000 (11:49 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 13 May 2020 11:14:29 +0000 (13:14 +0200)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/util/virnetdevopenvswitch.c

index 6c4e817941b73574b04f5ba5272ad4a40cf1349a..c9e0c4e956bbf5b8ed46addcbc4a9dc3ae6d9273 100644 (file)
@@ -71,7 +71,6 @@ static int
 virNetDevOpenvswitchConstructVlans(virCommandPtr cmd, const virNetDevVlan *virtVlan)
 {
     int ret = -1;
-    size_t i = 0;
     g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
 
     if (!virtVlan || !virtVlan->nTags)
@@ -92,6 +91,8 @@ virNetDevOpenvswitchConstructVlans(virCommandPtr cmd, const virNetDevVlan *virtV
     }
 
     if (virtVlan->trunk) {
+        size_t i;
+
         virBufferAddLit(&buf, "trunk=");
 
         /*
@@ -100,7 +101,7 @@ virNetDevOpenvswitchConstructVlans(virCommandPtr cmd, const virNetDevVlan *virtV
          * start of the for loop if there are more than one VLANs
          * on this trunk port.
          */
-        virBufferAsprintf(&buf, "%d", virtVlan->tag[i]);
+        virBufferAsprintf(&buf, "%d", virtVlan->tag[0]);
 
         for (i = 1; i < virtVlan->nTags; i++) {
             virBufferAddLit(&buf, ",");