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

Eric Farman farman at linux.vnet.ibm.com
Wed Jun 17 03:29:51 UTC 2015


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

Signed-off-by: Eric Farman <farman at linux.vnet.ibm.com>
---
 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




More information about the libvir-list mailing list