[libvirt] [PATCH 1/2] Don't skip zero'ing end of volume file when inputvol is shorter than newvol
Eric Blake
eblake at redhat.com
Mon Jul 19 23:15:40 UTC 2010
On 07/19/2010 05:08 PM, Laine Stump wrote:
> A missing set of braces around an error condition caused us to skip
> zero'ing out the remainder of a new volume file if the new volume was
> longer than the original (the goto was supposed to be taken only in
> the case of error, but was always being taken).
Ouch. Running a re-indenter would have spotted this, if we didn't have
too many other false-positive reindentations to sift through...
> ---
> src/storage/storage_backend.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
> index c185693..1eb8e33 100644
> --- a/src/storage/storage_backend.c
> +++ b/src/storage/storage_backend.c
> @@ -288,9 +288,10 @@ static int createRawFileOpHook(int fd, void *data) {
> if (hdata->inputvol) {
> int res = virStorageBackendCopyToFD(hdata->vol, hdata->inputvol,
> fd, &remain, 1);
> - if (res < 0)
> + if (res < 0) {
> ret = -res;
> goto cleanup;
> + }
ACK.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100719/2ed4a111/attachment-0001.sig>
More information about the libvir-list
mailing list