Disable use of floppy devices
authorColin Watson <cjwatson@debian.org>
Mon, 13 Jan 2014 12:12:54 +0000 (12:12 +0000)
committerFelix Zielcke <fzielcke@z-51.de>
Mon, 15 Jul 2024 15:05:20 +0000 (17:05 +0200)
An ugly kludge.  Should this be merged upstream?

Author: Robert Millan

Patch-Name: disable-floppies.patch

Gbp-Pq: Name disable-floppies.patch

grub-core/kern/emu/hostdisk.c

index 0e6eebdc8a0168eade802433c558540078e4645d..3e39fc663e93781b32cee368a104d21e54c1639d 100644 (file)
@@ -532,6 +532,18 @@ read_device_map (const char *dev_map)
          continue;
        }
 
+      if (! strncmp (p, "/dev/fd", sizeof ("/dev/fd") - 1))
+       {
+         char *q = p + sizeof ("/dev/fd") - 1;
+         if (*q >= '0' && *q <= '9')
+           {
+             free (map[drive].drive);
+             map[drive].drive = NULL;
+             grub_util_info ("`%s' looks like a floppy drive, skipping", p);
+             continue;
+           }
+       }
+
       /* On Linux, the devfs uses symbolic links horribly, and that
         confuses the interface very much, so use realpath to expand
         symbolic links.  */