[Libvirt-cim] [PATCH 2 of 3] Add graphics device support to VSMS

Dan Smith danms at us.ibm.com
Wed Nov 19 18:40:06 UTC 2008


KR> +static const char *graphics_rasd_to_vdev(CMPIInstance *inst,
KR> +                                         struct virt_device *dev)
KR> +{
KR> +        const char *val;
KR> +        const char *msg;
KR> +        const char *keymap;
KR> +        char *addr;
KR> +        char *port;
KR> +
KR> +        dev->dev.graphics.type = strdup("vnc");
KR> +
KR> +        if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK) {
KR> +                port = strdup("-1");
KR> +                addr = strdup("127.0.0.1");
KR> +        } else if (!parse_id(val, &addr, &port)) {

The parse_id() function returns an integer, not a boolean.

KR> +                msg = "GraphicsRASD field Address not valid";
KR> +                goto out;
KR> +        }
KR> +
KR> +        /* FIXME: Add logic to prevent address:port collisions */
KR> +        dev->dev.graphics.port = strdup(port);
KR> +        dev->dev.graphics.host = strdup(addr);

Can't you avoid the double-strdup()?

-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms at us.ibm.com




More information about the Libvirt-cim mailing list