[libvirt] [PATCH 07/10] openvz: Use strtok_r instead of sscanf for VPS UUID parsing

Eric Blake eblake at redhat.com
Wed Mar 31 16:14:11 UTC 2010


On 03/30/2010 10:20 AM, Matthias Bolte wrote:
> @@ -861,8 +862,10 @@ openvzGetVPSUUID(int vpsid, char *uuidstr, size_t len)
>              break;
>          }
>  
> -        sscanf(line, "%s %s\n", iden, uuidbuf);
> -        if(STREQ(iden, "#UUID:")) {
> +        iden = strtok_r(line, " ", &saveptr);
> +        uuidbuf = strtok_r(NULL, "", &saveptr);
> +
> +        if (iden != NULL && uuidbuf != NULL && STREQ(iden, "#UUID:")) {

ACK.

-- 
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/da6991eb/attachment-0001.sig>


More information about the libvir-list mailing list