]> git.proxmox.com Git - grub2.git/commitdiff
Disable use of floppy devices
authorColin Watson <cjwatson@debian.org>
Mon, 13 Jan 2014 12:12:54 +0000 (12:12 +0000)
committerColin Watson <cjwatson@debian.org>
Sun, 18 Sep 2016 16:42:44 +0000 (17:42 +0100)
An ugly kludge.  Should this be merged upstream?

Author: Robert Millan

Patch-Name: disable_floppies.patch

grub-core/kern/emu/hostdisk.c

index 87e3e251204f90348a45ea9079c716e052b5106b..d66e12d85e2e8531d6eb2af051a11f6e3bdb72b9 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.  */