[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] Handles the error returned by the xc_dom_allocate function

On Mon, 2015-10-26 at 10:40 +0000, Wei Liu wrote:

> > +           return -1;
> And, please set rv to a proper error code (presumably ENOMEM)

Please don't, xc_* functions should return -1 or NULL and set errno on
failure. (libxc error reporting is a bit of a mess, but this is the

So the caller here can assume that errno has already been set to something
appropriate (probably ENOMEM) and it is fine to translate the NULL into a 
-1 since the overall function returns an int not a pointer.

>  and use goto err, otherwise you're leaking xs_fd.

This is good advise and implies that rv should be set to -1 before the

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.