]> xenbits.xensource.com Git - libvirt.git/commitdiff
lxc: fix logic bug
authorEric Blake <eblake@redhat.com>
Sat, 8 Oct 2011 02:42:36 +0000 (20:42 -0600)
committerEric Blake <eblake@redhat.com>
Sat, 8 Oct 2011 02:49:12 +0000 (20:49 -0600)
Detected by Coverity.  We want to increment the size_t counter,
not the pointer to the counter.  Bug present since 5f5c6fde (0.9.5).

* src/lxc/lxc_controller.c (lxcSetupLoopDevices): Use correct
precedence.

src/lxc/lxc_controller.c

index 52d382ec1e338fd5bdd9f2134a0719e0f0fb17c1..51488e755c2a7cae7cef022fdd9b68e273831e16 100644 (file)
@@ -210,7 +210,7 @@ static int lxcSetupLoopDevices(virDomainDefPtr def, size_t *nloopDevs, int **loo
             virReportOOMError();
             goto cleanup;
         }
-        (*loopDevs)[*nloopDevs++] = fd;
+        (*loopDevs)[(*nloopDevs)++] = fd;
     }
 
     VIR_DEBUG("Setup all loop devices");