summaryrefslogtreecommitdiff
path: root/config/grub/patches/0004-prefix/0001-don-t-print-missing-prefix-errors-on-the-screen.patch
blob: 25091d16b2e621f68f0b5bf53382edc9fac09350 (plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
From 9e7a651a0f15f2e9dec65a77765c3c4fd97b4165 Mon Sep 17 00:00:00 2001
From: Leah Rowe <leah@libreboot.org>
Date: Sun, 5 Nov 2023 16:14:58 +0000
Subject: [PATCH 1/1] don't print missing prefix errors on the screen

we do actually set the prefix. this patch modifies
grub to still set grub_errno and return accordingly,
so the behaviour is otherwise identical, but it will
no longer print a warning message on the screen.

Signed-off-by: Leah Rowe <leah@libreboot.org>
---
 grub-core/commands/keylayouts.c | 2 +-
 grub-core/commands/loadenv.c    | 2 +-
 grub-core/commands/nativedisk.c | 2 +-
 grub-core/efiemu/main.c         | 3 +--
 grub-core/font/font.c           | 2 +-
 grub-core/kern/dl.c             | 2 +-
 6 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/grub-core/commands/keylayouts.c b/grub-core/commands/keylayouts.c
index 445fa0601..00bcf7025 100644
--- a/grub-core/commands/keylayouts.c
+++ b/grub-core/commands/keylayouts.c
@@ -211,7 +211,7 @@ grub_cmd_keymap (struct grub_command *cmd __attribute__ ((unused)),
     {
       const char *prefix = grub_env_get ("prefix");
       if (!prefix)
-	return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("variable `%s' isn't set"), "prefix");
+	return (grub_errno = GRUB_ERR_BAD_ARGUMENT);
       filename = grub_xasprintf ("%s/layouts/%s.gkb", prefix, argv[0]);
       if (!filename)
 	return grub_errno;
diff --git a/grub-core/commands/loadenv.c b/grub-core/commands/loadenv.c
index 166445849..699b39bfa 100644
--- a/grub-core/commands/loadenv.c
+++ b/grub-core/commands/loadenv.c
@@ -58,7 +58,7 @@ open_envblk_file (char *filename,
       prefix = grub_env_get ("prefix");
       if (! prefix)
         {
-          grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "prefix");
+          grub_errno = GRUB_ERR_FILE_NOT_FOUND;
           return 0;
         }
 
diff --git a/grub-core/commands/nativedisk.c b/grub-core/commands/nativedisk.c
index 580c8d3b0..6806bff9c 100644
--- a/grub-core/commands/nativedisk.c
+++ b/grub-core/commands/nativedisk.c
@@ -186,7 +186,7 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)),
   prefix = grub_env_get ("prefix");
 
   if (! prefix)
-    return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "prefix");
+    return (grub_errno = GRUB_ERR_FILE_NOT_FOUND);
 
   if (prefix)
     path_prefix = (prefix[0] == '(') ? grub_strchr (prefix, ')') : NULL;
diff --git a/grub-core/efiemu/main.c b/grub-core/efiemu/main.c
index e7037f4ed..e5d4dbff1 100644
--- a/grub-core/efiemu/main.c
+++ b/grub-core/efiemu/main.c
@@ -231,8 +231,7 @@ grub_efiemu_autocore (void)
   prefix = grub_env_get ("prefix");
 
   if (! prefix)
-    return grub_error (GRUB_ERR_FILE_NOT_FOUND,
-		       N_("variable `%s' isn't set"), "prefix");
+    return (grub_errno = GRUB_ERR_FILE_NOT_FOUND);
 
   suffix = grub_efiemu_get_default_core_name ();
 
diff --git a/grub-core/font/font.c b/grub-core/font/font.c
index 18de52562..2a0fea6c8 100644
--- a/grub-core/font/font.c
+++ b/grub-core/font/font.c
@@ -461,7 +461,7 @@ grub_font_load (const char *filename)
 
 	  if (!prefix)
 	    {
-	      grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "prefix");
+              grub_errno = GRUB_ERR_FILE_NOT_FOUND;
 	      goto fail;
 	    }
 	  file = try_open_from_prefix (prefix, filename);
diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
index 4011e2d15..af3bd00d0 100644
--- a/grub-core/kern/dl.c
+++ b/grub-core/kern/dl.c
@@ -758,7 +758,7 @@ grub_dl_load (const char *name)
     return 0;
 
   if (! grub_dl_dir) {
-    grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "prefix");
+    grub_errno = GRUB_ERR_FILE_NOT_FOUND;
     return 0;
   }
 
-- 
2.39.2