[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problem in usage of grub_errno...
From: |
Tomáš Ebenlendr |
Subject: |
Re: problem in usage of grub_errno... |
Date: |
Sat, 17 Dec 2005 23:59:36 +0100 (CET) |
User-agent: |
SquirrelMail/1.4.4 |
I think there is a 'bug' in the example. Or maybe I'm missing something.
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.
There are two options how to solve this:
* pop the stack (and choose which error should stay in grub_errno,
handle (report) the other one)
* write with BIG LETTERS to documentation of the function, that it
may push and not pop grub_errno when it fails. And check all calls
of this function, that this is handled properly (in code and/or in
documentation).
--
Tomas 'Ebi' Ebenlendr
http://get.to/ebik
- problem in usage of grub_errno..., Vesa Jääskeläinen, 2005/12/09
- Re: problem in usage of grub_errno..., Marco Gerards, 2005/12/09
- Re: problem in usage of grub_errno..., Vesa Jääskeläinen, 2005/12/10
- Re: problem in usage of grub_errno..., Yoshinori K. Okuji, 2005/12/10
- Re: problem in usage of grub_errno..., Vesa Jääskeläinen, 2005/12/10
- Re: problem in usage of grub_errno..., Vesa Jääskeläinen, 2005/12/17
- Re: problem in usage of grub_errno...,
Tomáš Ebenlendr <=
- Re: problem in usage of grub_errno..., Vesa Jääskeläinen, 2005/12/17
- Re: problem in usage of grub_errno..., Joel Buckley, 2005/12/19
- Re: problem in usage of grub_errno..., Vesa Jääskeläinen, 2005/12/19
- Re: problem in usage of grub_errno..., Tomáš Ebenlendr, 2005/12/19
- Re: problem in usage of grub_errno..., Vesa Jääskeläinen, 2005/12/19