Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NCG5p-0002Ww-B3 for mharc-grub-devel@gnu.org; Sun, 22 Nov 2009 12:19:21 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NCG5o-0002WN-Cr for grub-devel@gnu.org; Sun, 22 Nov 2009 12:19:20 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NCG5j-0002Tk-P2 for grub-devel@gnu.org; Sun, 22 Nov 2009 12:19:20 -0500 Received: from [199.232.76.173] (port=32976 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCG5j-0002TM-ER for grub-devel@gnu.org; Sun, 22 Nov 2009 12:19:15 -0500 Received: from 197.red-80-32-81.staticip.rima-tde.net ([80.32.81.197]:50857 helo=mail.pina.cat) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NCG5j-00082u-2K for grub-devel@gnu.org; Sun, 22 Nov 2009 12:19:15 -0500 Received: from pinux (82-45-164-87.cable.ubr06.hari.blueyonder.co.uk [82.45.164.87]) by mail.pina.cat (Postfix) with ESMTP id 272C5288FBA1E for ; Sun, 22 Nov 2009 18:19:14 +0100 (CET) Received: by pinux (Postfix, from userid 1000) id 97F689621; Sun, 22 Nov 2009 17:19:19 +0000 (GMT) Date: Sun, 22 Nov 2009 17:19:19 +0000 From: Carles Pina i Estany To: grub-devel@gnu.org Message-ID: <20091122171919.GD11942@pina.cat> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: errno handling X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Nov 2009 17:19:20 -0000 Hello, Last night I spent some time with a confussion that maybe it can be avoided (or maybe not). Let's say that a module calls grub_file_open and it fails (file doesn't exist or whatever). grub_errno is setted up. This module is not resetting grub_errno and makes another call to grub_file_open with a valid file. But grub_file_open does: ------ device_name = grub_file_get_device_name (name); if (grub_errno) return 0; ------ (without resetting grub_errno before or in grub_file_get_device_name) So caling grub_file_open with an invalid file name and then with valid one returns error two times. I was expecting the library functions to setup errno if there is some error. But not that the functions behaves different in function of the previous errno. Mainly because this can cause some strange effects changing the code (adding some call before that changes errno and the user is not resetting) I would reset errno at beginning of grub_file_open, and other places. I've search some documentation about the errno standard without succeeding, I'm sure that here there is people who is more familiar with it. -- Carles Pina i Estany http://pinux.info