
On Tue, Nov 03, 2009 at 04:07:40PM +0000, Matthew Booth wrote:
Note that, on its own, this patch will generate a warning about an unused static function. +/* This function outputs a -chardev command line option which describes only the + * host side of the character device */ +static int qemudBuildCommandLineChrDevChardevStr(virDomainChrDefPtr dev, + const char *const id, + char *buf, + int buflen) +{ + switch(dev->type) { + case VIR_DOMAIN_CHR_TYPE_NULL: + if (snprintf(buf, buflen, "null,id=%s", id) >= buflen) + return -1; + break;
Looks OK, but wouldn't it be preferable to use a virBuffer here instead of depending on the caller to allocate a large enough buffer? http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/util/buf.h;hb=HEAD Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v