2003-11-30 Yoshinori K. Okuji <okuji@enbug.org>

* lib/device.c (read_device_map) (sho_warning): New internal
	function.
	(read_device_map): If DRIVE is greater than 8, emit a warning
	and ignore the drive, rather than exiting abnormally.
	Reported by Greg Newby <newby@arsc.edu>.
This commit is contained in:
okuji 2003-11-30 17:13:12 +00:00
parent 49597fd5cb
commit 3b2816320b
2 changed files with 27 additions and 1 deletions

View file

@ -1,3 +1,11 @@
2003-11-30 Yoshinori K. Okuji <okuji@enbug.org>
* lib/device.c (read_device_map) (sho_warning): New internal
function.
(read_device_map): If DRIVE is greater than 8, emit a warning
and ignore the drive, rather than exiting abnormally.
Reported by Greg Newby <newby@arsc.edu>.
2003-10-19 Yoshinori K. Okuji <okuji@enbug.org>
Migrated to newer autotools. Also, don't install mkbimage

View file

@ -34,6 +34,7 @@
#include <fcntl.h>
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
#ifdef __linux__
# if !defined(__GLIBC__) || \
@ -395,6 +396,16 @@ read_device_map (FILE *fp, char **map, const char *map_file)
fprintf (stderr, "%s:%d: error: %s\n", map_file, no, msg);
}
static void show_warning (int no, const char *msg, ...)
{
va_list ap;
va_start (ap, msg);
fprintf (stderr, "%s:%d: warning: ", map_file, no);
vfprintf (stderr, msg, ap);
va_end (ap);
}
/* If there is the device map file, use the data in it instead of
probing devices. */
char buf[1024]; /* XXX */
@ -440,11 +451,18 @@ read_device_map (FILE *fp, char **map, const char *map_file)
ptr += 2;
drive = strtoul (ptr, &ptr, 10);
if (drive < 0 || drive > 8)
if (drive < 0)
{
show_error (line_number, "Bad device number");
return 0;
}
else if (drive > 8)
{
show_warning (line_number,
"Ignoring %cd%d due to a BIOS limitation",
is_floppy ? 'f' : 'h', drive);
continue;
}
if (! is_floppy)
drive += 0x80;