[Top][All Lists]

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

Re: /kern/file.c BUG

From: Pavel Roskin
Subject: Re: /kern/file.c BUG
Date: Thu, 24 Jan 2008 22:22:17 -0500

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

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.

Pavel Roskin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]