Received: from list by lists.gnu.org with archive (Exim 4.71) id 1bc8mm-00073U-3H for mharc-grub-devel@gnu.org; Tue, 23 Aug 2016 06:18:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bc8mj-0006w0-Ch for grub-devel@gnu.org; Tue, 23 Aug 2016 06:18:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bc8mf-00050m-Iw for grub-devel@gnu.org; Tue, 23 Aug 2016 06:18:20 -0400 Received: from smtp205.alice.it ([82.57.200.101]:53579) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bc8mf-0004uj-6m for grub-devel@gnu.org; Tue, 23 Aug 2016 06:18:17 -0400 Received: from jcn (82.51.74.25) by smtp205.alice.it (8.6.060.28) id 57B41B31019407A5; Tue, 23 Aug 2016 12:18:09 +0200 Received: from ao2 by jcn with local (Exim 4.87) (envelope-from ) id 1bc8mW-0004tc-Co; Tue, 23 Aug 2016 12:18:08 +0200 From: Antonio Ospite To: grub-devel@gnu.org Cc: Antonio Ospite Subject: [RFC PATCH 1/2] * grub-core/kern/disk.c: don't override grub_errmsg when grub_disk_open fails Date: Tue, 23 Aug 2016 12:17:27 +0200 Message-Id: <20160823101728.18774-2-ao2@ao2.it> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160823101728.18774-1-ao2@ao2.it> References: <20160823101728.18774-1-ao2@ao2.it> X-Face: z*RaLf`X<@C75u6Ig9}{oW$H; 1_\2t5)({*|jhM/Vb; ]yA5\I~93>J<_`<4)A{':UrE X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 82.57.200.101 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 10:18:22 -0000 In grub_disk_open() don't override error message when no _valid_ device can be found, instead use the one set from the last function which failed, which is more informative. The current message "disk not found" discards precious info about the reason of the failure; for instance the disk may exist but cannot be opened because of permissions issues, in this case telling "disk not found" is inaccurate and may mislead the user about the actual cause of the failure. https://savannah.gnu.org/bugs/?42409 --- grub-core/kern/disk.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/grub-core/kern/disk.c b/grub-core/kern/disk.c index 789f8c0..eb40523 100644 --- a/grub-core/kern/disk.c +++ b/grub-core/kern/disk.c @@ -233,8 +233,7 @@ grub_disk_open (const char *name) if (! dev) { - grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("disk `%s' not found"), - name); + grub_errno = GRUB_ERR_UNKNOWN_DEVICE; goto fail; } if (disk->log_sector_size > GRUB_DISK_CACHE_BITS + GRUB_DISK_SECTOR_BITS -- 2.9.3