|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] [PATCH] libxen-3.0 (libxc rewrite)
Christian Limpach wrote:
So far your only point for not using errno has been that the programmer
can inadvertently overwrite it by calling a function which resets it before
using its value. But even that now seems a moot point since it can still
happen with the 2nd type of functions. What's your problem with errno?
It's too easy to overwrite. Error paths are rarely invoked so if you're
overwriting errno in your error path the chances of you realizing you're
doing that is low.
This is a real problem. If you don't believe me, look at libxc. In
fact, the first file I opened, xc_private.c, has that problem exact
problem in the first function (xc_map_foreign_batch()). If the function
fails for any reason, it does cleanup (while also calling perror). The
cleanup function (munmap) will squash errno.
This function would have to save errno after the ioctl, then restore it
after the cleanup was done. That's ugly and most programmers don't
think to do it.
Regards,
Anthony Liguori
christian
-------------------------------------------------------
This SF.net email is sponsored by: 2005 Windows Mobile Application Contest
Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones
for the chance to win $25,000 and application distribution. Enter today at
http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel
|
|
|
|
|