xen: Use virStrToLong_i instead of sscanf for XenD port parsing

Parsing is stricter now and doesn't accept trailing characters
after the actual value anymore.
This commit is contained in:
Matthias Bolte 2010-03-30 16:52:42 +02:00
parent 82cb2e73aa
commit 57dab74804

View File

@ -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;