Gentoo Archives: gentoo-commits

From: "Robin H. Johnson (robbat2)" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo commit in src/patchsets/grub/0.97: 002_all_grub-0.97-splashimage-safety.patch
Date: Fri, 26 Jun 2009 23:39:10
Message-Id: E1MKL0d-0005Kp-Oj@stork.gentoo.org
1 robbat2 09/06/26 23:39:07
2
3 Added: 002_all_grub-0.97-splashimage-safety.patch
4 Log:
5 Prototype patch to fix bug #200505 secondary issue - do not start graphics mode unless the splashimage file is actually present.
6
7 Revision Changes Path
8 1.1 src/patchsets/grub/0.97/002_all_grub-0.97-splashimage-safety.patch
9
10 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/grub/0.97/002_all_grub-0.97-splashimage-safety.patch?rev=1.1&view=markup
11 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/grub/0.97/002_all_grub-0.97-splashimage-safety.patch?rev=1.1&content-type=text/plain
12
13 Index: 002_all_grub-0.97-splashimage-safety.patch
14 ===================================================================
15 Only start graphics mode if, and only if the splashimage file is available.
16 This saves trying to fall back to the original text mode and failing.
17
18 X-WARNING: untested, waiting for feedback on bug #200505.
19 Signed-off-by: Robin H. Johnson <robbat2@g.o>
20
21 diff -Nuar grub-0.97.orig/stage2/graphics.c grub-0.97/stage2/graphics.c
22 --- grub-0.97.orig/stage2/graphics.c 2009-06-26 16:21:05.000000000 -0700
23 +++ grub-0.97/stage2/graphics.c 2009-06-26 16:29:28.162450103 -0700
24 @@ -108,7 +108,11 @@
25 * mode. */
26 int graphics_init()
27 {
28 - if (!graphics_inited) {
29 + if(!grub_file_exists(splashimage)) {
30 + return 0;
31 + }
32 +
33 + if (!graphics_inited) {
34 saved_videomode = set_videomode(0x12);
35 }
36
37 @@ -549,4 +553,11 @@
38 MapMask(15);
39 }
40
41 +int grub_file_exists(char *s) {
42 + if (!grub_open(s))
43 + return 0;
44 + grub_close();
45 + return 1;
46 +}
47 +
48 #endif /* SUPPORT_GRAPHICS */
49 diff -Nuar grub-0.97.orig/stage2/graphics.h grub-0.97/stage2/graphics.h
50 --- grub-0.97.orig/stage2/graphics.h 2009-06-26 16:21:05.000000000 -0700
51 +++ grub-0.97/stage2/graphics.h 2009-06-26 16:34:03.302014350 -0700
52 @@ -36,6 +36,9 @@
53 void set_int1c_handler();
54 void unset_int1c_handler();
55
56 +/* Only to check for safe opening before we start */
57 +int grub_file_exists(char *s);
58 +
59 extern short cursorX, cursorY;
60 extern char cursorBuf[16];