grub-devel
[Top][All Lists]
Advanced

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

Re: problem in usage of grub_errno...


From: Vesa Jääskeläinen
Subject: Re: problem in usage of grub_errno...
Date: Sun, 18 Dec 2005 01:16:59 +0200
User-agent: Thunderbird 1.4.1 (Windows/20051006)

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




reply via email to

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