[libvirt] [PATCHv2 08/10] xenapi: Use virStrToLong_i instead of sscanf for CPU map parsing

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

 



Parsing is stricter now and doesn't accept trailing characters
after the actual value anymore.
---
 src/xenapi/xenapi_utils.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
index 60e3c8d..581bd90 100644
--- a/src/xenapi/xenapi_utils.c
+++ b/src/xenapi/xenapi_utils.c
@@ -309,7 +309,7 @@ getCpuBitMapfromString(char *mask, unsigned char *cpumap, int maplen)
     bzero(cpumap, maplen);
     num = strtok_r(mask, ",", &bp);
     while (num != NULL) {
-        if (sscanf(num, "%d", &pos) != 1)
+        if (virStrToLong_i(num, NULL, 10, &pos) < 0)
             return;
         if (pos < 0 || pos > max_bits - 1)
             VIR_WARN ("number in str %d exceeds cpumap's max bits %d", pos, max_bits);
-- 
1.6.3.3

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