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

Eric Blake eblake at redhat.com
Wed Mar 31 16:23:36 UTC 2010


On 03/30/2010 10:20 AM, Matthias Bolte wrote:
> ---
>  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..c910439 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) != 1) {

Worth documenting in the commit log that the change to no longer permit
trailing garbage is intentional.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 323 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100331/cb10988d/attachment-0001.sig>


More information about the libvir-list mailing list