[libvirt] [PATCH] qemu: Fix bogus warning about uninitialized saveptr

Eric Blake eblake at redhat.com
Wed Jan 5 16:01:13 UTC 2011


On 01/05/2011 08:11 AM, Jiri Denemark wrote:
> The warning is bogus since strtok_r doesn't use the value when it's
> first called and initializes it for the following calls.
> ---
>  src/qemu/qemu_command.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index bde3904..7dd8e03 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -5621,7 +5621,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
>      if (def->ndisks > 0) {
>          const char *ceph_args = qemuFindEnv(progenv, "CEPH_ARGS");
>          if (ceph_args) {
> -            char *hosts, *port, *saveptr, *token;
> +            char *hosts, *port, *saveptr = NULL, *token;

ACK; harmless enough to silence the bogus warning.

-- 
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: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110105/1661f325/attachment-0001.sig>


More information about the libvir-list mailing list