[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH 1/2] * grub-core/kern/disk.c: don't override grub_errmsg when

From: 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

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.
 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]