On 11/03/2013 06:48 PM, Wenchao Xia wrote: >> On 14.10.2013 23:52, Wenchao Xia wrote: >>> The function still returns int since qcow2_snapshot_delete() will >>> return the number. >>>
>>> @@ -227,24 +239,40 @@ static int >>> qcow2_write_snapshots(BlockDriverState *bs) >>> >>> ret = bdrv_pwrite(bs->file, offset, &h, sizeof(h)); >>> if (ret < 0) { >>> + error_setg(errp, >>> + "Failed in write of snapshot header at %" >>> + PRIi64 " with size %" PRIu64 ": %d (%s)", >>> + offset, sizeof(h), ret, strerror(-ret)); >> >> Again, on 32 bit systems, sizeof(size_t) is generally 4 and not 8 (you >> may want to cast sizeof(h) to int and just use %d). >> > > Maybe caset as (int64_t)sizeof(h) to avoid possible incomplete value? If we have objects larger than 2G (such that sizeof(h) would require more than 31 bits), we have other issues to worry about. Casting to int and using %d is safe enough. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature