From 678e849cd303b9c0d7a3f563c36cf59ed1c7f367 Mon Sep 17 00:00:00 2001 From: robertmh Date: Thu, 28 Aug 2008 14:36:18 +0000 Subject: [PATCH] 2008-08-28 Robert Millan Change find_grub_drive() syntax so it doesn't prevent it from detecting NULL names as errors. * util/biosdisk.c (find_grub_drive): Move free slot search code from here ... (find_free_slot): ... to here. (read_device_map): Use find_free_slot() to search for free slots. --- ChangeLog | 10 ++++++++++ util/biosdisk.c | 18 +++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1cf7194c6..52fa13eff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-08-28 Robert Millan + + Change find_grub_drive() syntax so it doesn't prevent it from + detecting NULL names as errors. + + * util/biosdisk.c (find_grub_drive): Move free slot search code + from here ... + (find_free_slot): ... to here. + (read_device_map): Use find_free_slot() to search for free slots. + 2008-08-27 Marco Gerards * conf/common.rmk (pkglib_MODULES): Add scsi.mod. diff --git a/util/biosdisk.c b/util/biosdisk.c index fa1143b1f..9fc158373 100644 --- a/util/biosdisk.c +++ b/util/biosdisk.c @@ -120,12 +120,16 @@ find_grub_drive (const char *name) if (map[i].drive && ! strcmp (map[i].drive, name)) return i; } - else - { - for (i = 0; i < sizeof (map) / sizeof (map[0]); i++) - if (! map[i].drive) - return i; - } + + return -1; +} + +static int +find_free_slot () +{ + for (i = 0; i < sizeof (map) / sizeof (map[0]); i++) + if (! map[i].drive) + return i; return -1; } @@ -503,7 +507,7 @@ read_device_map (const char *dev_map) p++; /* Find a free slot. */ - drive = find_grub_drive (NULL); + drive = find_free_slot (); if (drive < 0) show_error ("Map table size exceeded");