From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EnlJE-0000UU-Ge for mharc-grub-devel@gnu.org; Sat, 17 Dec 2005 18:17:48 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EnlJD-0000UO-9w for grub-devel@gnu.org; Sat, 17 Dec 2005 18:17:47 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EnlJA-0000Tr-TY for grub-devel@gnu.org; Sat, 17 Dec 2005 18:17:47 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EnlJA-0000To-R2 for grub-devel@gnu.org; Sat, 17 Dec 2005 18:17:44 -0500 Received: from [81.228.11.98] (helo=pne-smtpout1-sn1.fre.skanova.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EnlLq-0005LU-6D for grub-devel@gnu.org; Sat, 17 Dec 2005 18:20:30 -0500 Received: from [80.222.173.234] (80.222.173.234) by pne-smtpout1-sn1.fre.skanova.net (7.2.069.1) id 43A2BDFC000586BE for grub-devel@gnu.org; Sun, 18 Dec 2005 00:16:55 +0100 Message-ID: <43A49C6B.1080408@nic.fi> Date: Sun, 18 Dec 2005 01:16:59 +0200 From: =?ISO-8859-2?Q?Vesa_J=E4=E4skel=E4inen?= User-Agent: Thunderbird 1.4.1 (Windows/20051006) MIME-Version: 1.0 To: The development of GRUB 2 References: <4399FE01.7010402@nic.fi> <87mzj9q4z7.fsf@xs4all.nl> <439AA87B.9050607@nic.fi> <200512101411.11612.okuji@enbug.org> <439B369D.7020909@nic.fi> <43A44DA4.5090601@nic.fi> <1652.62.240.162.34.1134860376.squirrel@drak.ucw.cz> In-Reply-To: <1652.62.240.162.34.1134860376.squirrel@drak.ucw.cz> X-Enigmail-Version: 0.93.0.0 Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: Quoted-Printable Subject: Re: problem in usage of grub_errno... X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Dec 2005 23:17:47 -0000 Tom=E1=B9 Ebenlendr wrote: > I think there is a 'bug' in the example. Or maybe I'm missing something= =2E Nope, it was intentional. :) > On 17 Prosinec 2005, 18:40, Vesa J=E4=E4skel=E4inen napsal(a): > .... >> --- >> /* Save possible old error message. */ >> grub_error_push (); >> >> /* Do your stuff here. */ >> call_possibly_failing_function (); >> >> if (grub_errno !=3D 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 (); >> --- > .... >=20 > When grub_errno !=3D 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=E4=E4skel=E4inen