[libvirt] [PATCH 4/7] Factor qemudMonitorSend() out of qemudMonitorCommandExtra()

Mark McLoughlin markmc at redhat.com
Mon Jul 27 09:12:02 UTC 2009


On Mon, 2009-07-27 at 10:50 +0200, Daniel Veillard wrote:
> On Wed, Jul 22, 2009 at 10:57:33PM +0100, Mark McLoughlin wrote:
> > Add a little helper function to write the monitor command followed by
> > carriage return in a single write.
> > 
> > This doesn't make any real difference, but allows us to more easily
> > switch to using sendmsg() when using the monitor over a unix socket.
> [...]
> > +static int
> > +qemudMonitorSend(const virDomainObjPtr vm,
> > +                 const char *cmd)
> > +{
> > +    char *full;
> > +    size_t len;
> > +    int ret = -1;
> > +
> > +    if (virAsprintf(&full, "%s\r", cmd) < 0)
> > +        return -1;
> 
>   Hum, we introduce an allocation here, and if it fails we really
>   should call the OOM errror centralized routine

The other error cases in this function don't set an error and every call
to qemudMonitorCommand() sets an error if it fails.

Cheers,
Mark.




More information about the libvir-list mailing list