[PATCH 1/2] Don't skip zero'ing end of volume file when inputvol is shorter than newvol

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 |    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;
+        }
     }
 
     if (remain) {
-- 
1.7.1.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]