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

Re: [Xen-devel] [PATCH] libxl: improve error handling when saving device model state



On Fri, 16 Dec 2011, Ian Campbell wrote:

> On Thu, 2011-12-15 at 17:00 +0000, Ian Jackson wrote:
> > Ian Campbell writes ("[Xen-devel] [PATCH] libxl: improve error handling 
> > when saving device model state"):
> > > libxl: improve error handling when saving device model state.
> > ...
> > > +out_close_fd2:
> > >      close(fd2);
> > > +out_unlink:
> > >      unlink(filename);
> >
> > This style of error handling is very prone to errors.
> >
> > How about:
> >
> >     int fd2 = -1;
> >
> >     blah blah maybe goto out blah blah
> >
> >     if (fd2 >= 0) close(fd2);
> >
> > And always unlinking the filename is fine, surely ?
>
> Yes. Patch is below.
>
> In principal it ought to be possible to save upstream qemu state direct
> to the fd and avoid the file altogether, Anthony what do you think?

Upstream QEMU only use the fd, so only xl now about the filename.
I've just create the file because it was more convenient to use in libxl
than changing more code.

So yes, we can avoid the file.

And the patch looks fine to me.

Regards,

-- 
Anthony PERARD

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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