From: Laine Stump Date: Mon, 19 Jul 2010 22:53:38 +0000 (-0400) Subject: Don't skip zero'ing end of volume file when inputvol is shorter than newvol X-Git-Tag: v0.8.3~109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35bebb57824d6addd158c286d07fa07236187aa1;p=thirdparty%2Flibvirt.git Don't skip zero'ing end of volume file when inputvol is shorter than newvol 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). --- diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index c1856932c7..1eb8e33a7a 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; + } } if (remain) {