[libvirt] [PATCHv2 09/10] xen: Use virStrToLong_i instead of sscanf for XenD port parsing

Matthias Bolte matthias.bolte at googlemail.com
Wed Mar 31 21:42:02 UTC 2010


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

diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 0649d23..691a940 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -4683,7 +4683,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
     else if ((p = strrchr (uri, ':')) != NULL) { /* "hostname:port" */
         int port_nr, n;
 
-        if (sscanf (p+1, "%d", &port_nr) != 1) {
+        if (virStrToLong_i(p+1, NULL, 10, &port_nr) < 0) {
             virXendError (conn, VIR_ERR_INVALID_ARG,
                           "%s", _("xenDaemonDomainMigrate: invalid port number"));
             return -1;
-- 
1.6.3.3




More information about the libvir-list mailing list