Tomáš Ebenlendr wrote:
> I think there is a 'bug' in the example. Or maybe I'm missing something.
Nope, it was intentional. :)
> On 17 Prosinec 2005, 18:40, Vesa Jääskeläinen napsal(a):
> ....
>> ---
>> /* Save possible old error message. */
>> grub_error_push ();
>>
>> /* Do your stuff here. */
>> call_possibly_failing_function ();
>>
>> if (grub_errno != GRUB_ERR_NONE)
>> {
>> /* Inform rest of the code that there is error (grub_errno
>> is set). */
>> return;
>> }
>>
>> /* Restore old error state by popping previous item from stack. */
>> grub_error_pop ();
>> ---
> ....
>
> When grub_errno != GRUB_ERR_NONE (branching into the 'if'), then
> there is no grub_error_pop() in the example.
> If the whole thing will be called in a loop, then unwanted
> stack overflow can simply occur.
Error stack is statically allocated and it is protected so that it
cannot overflow. Error stack is defined as being static to file
kern/err.c so there is no direct access possible to error stack.
Error stack is emptied in grub_print_error function. (And this is called
before prompt is printed to screen)
Idea of the error stack is to record all error messages before they are
printed.
Or did I miss your idea with the "unwanted stack overflow" ?
Thanks,
Vesa Jääskeläinen
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel