util: fix index when building lock owners array

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.
This commit is contained in:
Laine Stump 2012-11-14 12:07:13 -05:00
parent 3782814d4a
commit bc4b433098

View 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) {