On Wed, Aug 27, 2008 at 08:24:11AM +0930, Arthur Marsh wrote:
> 
> The following error makes sense for a floppy drive with no disk in it, 

Well, I'm still not sure what it's caused by.

The problem I see now is that the design of grub_find_drive() prevents us
from detecting NULL pointers as errors, and so we don't know if `name' was
NULL or otherwise a non-NULL drive was paired with a NULL device.

So please, try with this patch (in addition to what you had before).

I realize this is getting annoyingly long;  thanks for your patience in
going through it, it's very appreciated.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
Index: util/biosdisk.c
===================================================================
--- util/biosdisk.c	(revision 1830)
+++ util/biosdisk.c	(working copy)
@@ -120,17 +120,21 @@
 	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;
+}
+
+static int
 grub_util_biosdisk_iterate (int (*hook) (const char *name))
 {
   unsigned i;
@@ -503,7 +507,7 @@
 
       p++;
       /* Find a free slot.  */
-      drive = find_grub_drive (NULL);
+      drive = find_free_slot ();
       if (drive < 0)
 	show_error ("Map table size exceeded");
 

Reply via email to