]> xenbits.xensource.com Git - people/dariof/libvirt.git/commitdiff
util: fix index when building lock owners array
authorLaine Stump <laine@laine.org>
Wed, 14 Nov 2012 17:07:13 +0000 (12:07 -0500)
committerLaine Stump <laine@laine.org>
Wed, 14 Nov 2012 17:43:49 +0000 (12:43 -0500)
The "restart" function for locks allocates a new array according to
and pre-sets its length, then reads the owner pids from a JSON
document in a loop. Rather than adding each owner at a different
index, though, it repeatedly overwrites the last element of the array
with all the owners.

src/util/virlockspace.c

index 7e8c0a74f6e4e1e70789773841c61114d51368de..99b61827a1774e109adfe4fd789903dbef149236 100644 (file)
@@ -435,7 +435,7 @@ virLockSpacePtr virLockSpaceNewPostExecRestart(virJSONValuePtr object)
                 goto error;
             }
 
-            res->owners[res->nOwners-1] = (pid_t)owner;
+            res->owners[j] = (pid_t)owner;
         }
 
         if (virHashAddEntry(lockspace->resources, res->name, res) < 0) {