File: disable-floppies.patch

package info (click to toggle)
grub2 2.14~git20250718.0e36779-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 60,688 kB
  • sloc: ansic: 541,811; asm: 68,074; sh: 9,803; cpp: 2,095; makefile: 1,895; python: 1,518; sed: 446; lex: 393; yacc: 268; awk: 85; lisp: 54; perl: 31
file content (36 lines) | stat: -rw-r--r-- 1,043 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From: Colin Watson <cjwatson@debian.org>
Date: Mon, 13 Jan 2014 12:12:54 +0000
Subject: Disable use of floppy devices

An ugly kludge.  Should this be merged upstream?

Author: Robert Millan

Patch-Name: disable-floppies.patch
---
 grub-core/kern/emu/hostdisk.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/grub-core/kern/emu/hostdisk.c b/grub-core/kern/emu/hostdisk.c
index 0e6eebd..3e39fc6 100644
--- a/grub-core/kern/emu/hostdisk.c
+++ b/grub-core/kern/emu/hostdisk.c
@@ -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.  */