From 3cbd2f98c6f0bdbdd9e5a678fa89931b754f3e06 Mon Sep 17 00:00:00 2001 From: robertmh Date: Mon, 7 Apr 2008 15:00:27 +0000 Subject: [PATCH] 2008-04-07 Robert Millan * 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). --- ChangeLog | 6 ++++++ util/biosdisk.c | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 02023f62d..30d973c6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-04-07 Robert Millan + + * 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 * util/biosdisk.c: Include grub/util/biosdisk.h. diff --git a/util/biosdisk.c b/util/biosdisk.c index 2d3d6017b..e6e7f51ed 100644 --- a/util/biosdisk.c +++ b/util/biosdisk.c @@ -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