On Thu, 2008-01-24 at 21:43 +0000, Oleg Strikov wrote: > But is it correct to check and handle errno in some `library` > function (now we do) ? I CAN, but i do not have to examine > errno after each non-error-free call; is it right?
I don't know how grub_errno is supposed to work, so I cannot comment on that. But normally it's OK to read errno if it's known that some error has happened. It makes it possible to have one error handler that would not specify which exactly call has failed. For instance, it's not important if an I/O error happened when opening the file or when reading from it, or when closing it. It should be OK to set errno to 0 only if it's definitely known that the callers (not necessarily the immediate caller) don't expect errno to be preserved. Therefore, setting errno to 0 in a library would be wrong. -- Regards, Pavel Roskin _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel