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

[libvirt] [PATCH 1/3] storage: mpath: Clean up some error handling



We were squashing error messages in a few cases. Recode to follow common
ret = -1 convention.

Signed-off-by: Cole Robinson <crobinso redhat com>
---
 src/storage/storage_backend_mpath.c |   20 ++++----------------
 1 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/src/storage/storage_backend_mpath.c b/src/storage/storage_backend_mpath.c
index 8318969..6351fe1 100644
--- a/src/storage/storage_backend_mpath.c
+++ b/src/storage/storage_backend_mpath.c
@@ -43,39 +43,27 @@ virStorageBackendMpathUpdateVolTargetInfo(virStorageVolTargetPtr target,
                                           unsigned long long *allocation,
                                           unsigned long long *capacity)
 {
-    int ret = 0;
+    int ret = -1;
     int fd = -1;
 
     if ((fd = open(target->path, O_RDONLY)) < 0) {
         virReportSystemError(errno,
                              _("cannot open volume '%s'"),
                              target->path);
-        ret = -1;
         goto out;
     }
 
     if (virStorageBackendUpdateVolTargetInfoFD(target,
                                                fd,
                                                allocation,
-                                               capacity) < 0) {
+                                               capacity) < 0)
 
-        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
-                          _("Failed to update volume target info for '%s'"),
-                          target->path);
-
-        ret = -1;
         goto out;
-    }
-
-    if (virStorageBackendUpdateVolTargetFormatFD(target, fd) < 0) {
-        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
-                          _("Failed to update volume target format for '%s'"),
-                          target->path);
 
-        ret = -1;
+    if (virStorageBackendUpdateVolTargetFormatFD(target, fd) < 0)
         goto out;
-    }
 
+    ret = 0;
 out:
     if (fd != -1) {
         close(fd);
-- 
1.6.6.1


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