]> xenbits.xensource.com Git - libvirt.git/commitdiff
Don't skip zero'ing end of volume file when inputvol is shorter than newvol
authorLaine Stump <laine@laine.org>
Mon, 19 Jul 2010 22:53:38 +0000 (18:53 -0400)
committerLaine Stump <laine@laine.org>
Tue, 20 Jul 2010 01:01:12 +0000 (21:01 -0400)
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).

src/storage/storage_backend.c

index c1856932c72e844164cdfd3999c4eb08413e0c49..1eb8e33a7a1c1976e651ad50fdcc2cad437504ed 100644 (file)
@@ -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) {