[PATCH 1/5] storage: fix return values of virStorageBackendWipeExtentLocal

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

 



Return -1:
* on all failures of fdatasync. Instead of propagating -errno
  all the way up to the virStorageVolWipe API, which is documented
  to return 0 or -1.
* after a partial wipe. If safewrite failed, we would re-use the
  non-negative return value of lseek (which should be 0 in this case,
  because that's the only offset we seek to).
---
 src/storage/storage_backend.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 6915b8a..f62ebff 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -2002,7 +2002,7 @@ virStorageBackendWipeExtentLocal(virStorageVolDefPtr vol,
     VIR_DEBUG("extent logical start: %ju len: %ju",
               (uintmax_t)extent_start, (uintmax_t)extent_length);
 
-    if ((ret = lseek(fd, extent_start, SEEK_SET)) < 0) {
+    if (lseek(fd, extent_start, SEEK_SET) < 0) {
         virReportSystemError(errno,
                              _("Failed to seek to position %ju in volume "
                                "with path '%s'"),
@@ -2029,7 +2029,6 @@ virStorageBackendWipeExtentLocal(virStorageVolDefPtr vol,
     }
 
     if (fdatasync(fd) < 0) {
-        ret = -errno;
         virReportSystemError(errno,
                              _("cannot sync data to volume with path '%s'"),
                              vol->target.path);
-- 
2.4.6

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