[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



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 ?

Ian.

_______________________________________________
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®.