[PATCH v3 3/6] storage: Set ret = -1 on failures in virStorageBackendUpdateVolTargetInfo

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

 



While processing the volume for lseek, virFileReadHeaderFD, and
virStorageFileGetMetadataFromBuf - failure would cause an error,
but ret would not be set. That would result in an error message being
sent, but successful status being returned.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/storage/storage_backend.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 1ee83aa..8eb5b04 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -1625,16 +1625,19 @@ virStorageBackendUpdateVolTargetInfo(virStorageSourcePtr target,
 
         if (lseek(fd, 0, SEEK_SET) == (off_t)-1) {
             virReportSystemError(errno, _("cannot seek to start of '%s'"), target->path);
+            ret = -1;
             goto cleanup;
         }
 
         if ((len = virFileReadHeaderFD(fd, len, &buf)) < 0) {
             virReportSystemError(errno, _("cannot read header '%s'"), target->path);
+            ret = -1;
             goto cleanup;
         }
 
         if (!(meta = virStorageFileGetMetadataFromBuf(target->path, buf, len, target->format,
                                                       NULL))) {
+            ret = -1;
             goto cleanup;
         }
 
-- 
2.5.0

--
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]