Skip to contentSkip to conversation

Grub-devel Digest, Vol 47, Issue 99

DISCUSSION Oleg Strikov 2 participants 2 messages Jan 24, 2008 – Jan 25, 2008 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines

Previous behavior was working correctly. You have to handle errorcodes
at some point and that means when error is handled it is zeroed (or GRUB_ERR_NONE). So code is in callee where that loop was.

Quoted 8 lines
Quoted 8 lines

I suggest that we never set grub_errno to 0 (except the initialization). That would match the standard errno behavior:

http://www.opengroup.org/onlinepubs/009695399/functions/errno.html<http://www.opengroup.org/onlinepubs/009695399/functions/errno.html>

--
Regards,
Pavel Roskin

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?

#2 lore raw
Quoted 5 lines · Oleg Strikov
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines

Previous behavior was working correctly. You have to handle errorcodes
at some point and that means when error is handled it is zeroed (or GRUB_ERR_NONE). So code is in callee where that loop was.

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

I suggest that we never set grub_errno to 0 (except the initialization). That would match the standard errno behavior:

http://www.opengroup.org/onlinepubs/009695399/functions/errno.html<http://www.opengroup.org/onlinepubs/009695399/functions/errno.html>

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?

This documentation about errno does NOT match grub_errno, please keep that in mind :-)

You should *always* check for errors. *always* check if memory allocation succeeded, etc. If you write code that ignored errors, it is broken.

A more explicit approach would be letting every function return grub_err_t.

--
Marco