2008-04-07 Robert Millan <rmh@aybabtu.com>

* util/biosdisk.c (read_device_map): Skip devices that don't exist
        (this prevents the presence of a bogus entry from ruining the whole
        thing).
This commit is contained in:
robertmh 2008-04-07 15:00:27 +00:00
parent 36747a6221
commit 3cbd2f98c6
2 changed files with 14 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2008-04-07 Robert Millan <rmh@aybabtu.com>
* util/biosdisk.c (read_device_map): Skip devices that don't exist
(this prevents the presence of a bogus entry from ruining the whole
thing).
2008-04-06 Pavel Roskin <proski@gnu.org>
* util/biosdisk.c: Include grub/util/biosdisk.h.

View file

@ -486,8 +486,9 @@ read_device_map (const char *dev_map)
FILE *fp;
char buf[1024]; /* XXX */
int lineno = 0;
auto void show_error (const char *msg);
struct stat st;
auto void show_error (const char *msg);
void show_error (const char *msg)
{
grub_util_error ("%s:%d: %s", dev_map, lineno, msg);
@ -543,6 +544,12 @@ read_device_map (const char *dev_map)
if (map[drive])
show_error ("Duplicated entry found");
if (stat (p, &st) == -1)
{
grub_util_info ("Cannot stat `%s', skipping", p);
continue;
}
#ifdef __linux__
/* On Linux, the devfs uses symbolic links horribly, and that
confuses the interface very much, so use realpath to expand