[libvirt] [PATCH] util: fix index when building lock owners array
Eric Blake
eblake at redhat.com
Wed Nov 14 17:18:31 UTC 2012
On 11/14/2012 10:12 AM, Laine Stump wrote:
> 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 | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
ACK.
>
> diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c
> index 7e8c0a7..99b6182 100644
> --- a/src/util/virlockspace.c
> +++ b/src/util/virlockspace.c
> @@ -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) {
>
--
Eric Blake eblake at redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121114/97363951/attachment-0001.sig>
More information about the libvir-list
mailing list