[PATCH 1/5] Print SCSI logical unit as a positive integer

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

 



A logical unit address is a positive integer, so it would be wise
to reject any negative inputs.

Signed-off-by: Eric Farman <farman@xxxxxxxxxxxxxxxxxx>
---
 src/conf/domain_conf.c | 2 +-
 tools/virsh-domain.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ca55981..9e77b87 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4954,7 +4954,7 @@ virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePtr sourcenode,
                     goto cleanup;
                 }
 
-                if (virStrToLong_ui(unit, NULL, 0, &scsihostsrc->unit) < 0) {
+                if (virStrToLong_uip(unit, NULL, 0, &scsihostsrc->unit) < 0) {
                     virReportError(VIR_ERR_INTERNAL_ERROR,
                                    _("cannot parse unit '%s'"), unit);
                     goto cleanup;
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 4c47473..0bea462 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -488,7 +488,7 @@ static int str2SCSIAddress(const char *str, struct SCSIAddress *scsiAddr)
         return -1;
 
     unit++;
-    if (virStrToLong_ui(unit, NULL, 0, &scsiAddr->unit) != 0)
+    if (virStrToLong_uip(unit, NULL, 0, &scsiAddr->unit) != 0)
         return -1;
 
     return 0;
-- 
1.9.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]