Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Enl33-0004Zk-0e for mharc-grub-devel@gnu.org; Sat, 17 Dec 2005 18:01:05 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Enl31-0004ZG-AK for grub-devel@gnu.org; Sat, 17 Dec 2005 18:01:03 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Enl2g-0004V4-Q0 for grub-devel@gnu.org; Sat, 17 Dec 2005 18:01:03 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Enl2g-0004V1-MA for grub-devel@gnu.org; Sat, 17 Dec 2005 18:00:42 -0500 Received: from [212.71.128.78] (helo=drak.ucw.cz) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Enl5L-0002Ar-5Q for grub-devel@gnu.org; Sat, 17 Dec 2005 18:03:27 -0500 Received: from drak.ucw.cz (localhost [127.0.0.1]) by drak.ucw.cz (Postfix) with ESMTP id 27B30C1 for ; Sat, 17 Dec 2005 23:59:36 +0100 (CET) Received: from 62.240.162.34 (SquirrelMail authenticated user ebik) by drak.ucw.cz with HTTP; Sat, 17 Dec 2005 23:59:36 +0100 (CET) Message-ID: <1652.62.240.162.34.1134860376.squirrel@drak.ucw.cz> In-Reply-To: <43A44DA4.5090601@nic.fi> 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> Date: Sat, 17 Dec 2005 23:59:36 +0100 (CET) From: =?iso-8859-2?Q?Tom=E1=B9_Ebenlendr?= To: "The development of GRUB 2" User-Agent: SquirrelMail/1.4.4 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-2 X-Priority: 3 (Normal) Importance: Normal 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:01:03 -0000 I think there is a 'bug' in the example. Or maybe I'm missing something. 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 (); > --- .... 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. 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). --=20 Tomas 'Ebi' Ebenlendr http://get.to/ebik