[PATCH] libvirt: hostdev SCSI AdapterId retrieval fix

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

 



Fixed the retrieval of the AdapterId from the AdapterName of the
hostdev source so it does return an error instead of leaving the
adapter_id uninitialized.

Signed-off-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Viktor Mihajlovski <mihajlov@xxxxxxxxxxxxxxxxxx>
---
 src/util/virscsi.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/util/virscsi.c b/src/util/virscsi.c
index 43658c0..7aca9e6 100644
--- a/src/util/virscsi.c
+++ b/src/util/virscsi.c
@@ -88,16 +88,13 @@ static int
 virSCSIDeviceGetAdapterId(const char *adapter,
                           unsigned int *adapter_id)
 {
-    if (STRPREFIX(adapter, "scsi_host")) {
-        if (virStrToLong_ui(adapter + strlen("scsi_host"),
-                            NULL, 0, adapter_id) < 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Cannot parse adapter '%s'"), adapter);
-            return -1;
-        }
-    }
-
-    return 0;
+    if (STRPREFIX(adapter, "scsi_host") &&
+        virStrToLong_ui(adapter + strlen("scsi_host"),
+                        NULL, 0, adapter_id) == 0)
+        return 0;
+    virReportError(VIR_ERR_INTERNAL_ERROR,
+                   _("Cannot parse adapter '%s'"), adapter);
+    return -1;
 }

 char *
--
1.8.3.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]