0011-don-t-print-missing-prefix-errors-on-the-screen.patch 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. From d14c9af2656ee6b63b029ac28816f38d4ae26946 Mon Sep 17 00:00:00 2001
  2. From: Leah Rowe <leah@libreboot.org>
  3. Date: Sun, 5 Nov 2023 16:14:58 +0000
  4. Subject: [PATCH 11/14] don't print missing prefix errors on the screen
  5. we do actually set the prefix. this patch modifies
  6. grub to still set grub_errno and return accordingly,
  7. so the behaviour is otherwise identical, but it will
  8. no longer print a warning message on the screen.
  9. Signed-off-by: Leah Rowe <leah@libreboot.org>
  10. ---
  11. grub-core/commands/keylayouts.c | 2 +-
  12. grub-core/commands/loadenv.c | 2 +-
  13. grub-core/commands/nativedisk.c | 2 +-
  14. grub-core/efiemu/main.c | 3 +--
  15. grub-core/font/font.c | 2 +-
  16. grub-core/kern/dl.c | 2 +-
  17. 6 files changed, 6 insertions(+), 7 deletions(-)
  18. diff --git a/grub-core/commands/keylayouts.c b/grub-core/commands/keylayouts.c
  19. index 445fa0601..00bcf7025 100644
  20. --- a/grub-core/commands/keylayouts.c
  21. +++ b/grub-core/commands/keylayouts.c
  22. @@ -211,7 +211,7 @@ grub_cmd_keymap (struct grub_command *cmd __attribute__ ((unused)),
  23. {
  24. const char *prefix = grub_env_get ("prefix");
  25. if (!prefix)
  26. - return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("variable `%s' isn't set"), "prefix");
  27. + return (grub_errno = GRUB_ERR_BAD_ARGUMENT);
  28. filename = grub_xasprintf ("%s/layouts/%s.gkb", prefix, argv[0]);
  29. if (!filename)
  30. return grub_errno;
  31. diff --git a/grub-core/commands/loadenv.c b/grub-core/commands/loadenv.c
  32. index 166445849..699b39bfa 100644
  33. --- a/grub-core/commands/loadenv.c
  34. +++ b/grub-core/commands/loadenv.c
  35. @@ -58,7 +58,7 @@ open_envblk_file (char *filename,
  36. prefix = grub_env_get ("prefix");
  37. if (! prefix)
  38. {
  39. - grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "prefix");
  40. + grub_errno = GRUB_ERR_FILE_NOT_FOUND;
  41. return 0;
  42. }
  43. diff --git a/grub-core/commands/nativedisk.c b/grub-core/commands/nativedisk.c
  44. index 580c8d3b0..6806bff9c 100644
  45. --- a/grub-core/commands/nativedisk.c
  46. +++ b/grub-core/commands/nativedisk.c
  47. @@ -186,7 +186,7 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)),
  48. prefix = grub_env_get ("prefix");
  49. if (! prefix)
  50. - return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "prefix");
  51. + return (grub_errno = GRUB_ERR_FILE_NOT_FOUND);
  52. if (prefix)
  53. path_prefix = (prefix[0] == '(') ? grub_strchr (prefix, ')') : NULL;
  54. diff --git a/grub-core/efiemu/main.c b/grub-core/efiemu/main.c
  55. index e7037f4ed..e5d4dbff1 100644
  56. --- a/grub-core/efiemu/main.c
  57. +++ b/grub-core/efiemu/main.c
  58. @@ -231,8 +231,7 @@ grub_efiemu_autocore (void)
  59. prefix = grub_env_get ("prefix");
  60. if (! prefix)
  61. - return grub_error (GRUB_ERR_FILE_NOT_FOUND,
  62. - N_("variable `%s' isn't set"), "prefix");
  63. + return (grub_errno = GRUB_ERR_FILE_NOT_FOUND);
  64. suffix = grub_efiemu_get_default_core_name ();
  65. diff --git a/grub-core/font/font.c b/grub-core/font/font.c
  66. index 18de52562..2a0fea6c8 100644
  67. --- a/grub-core/font/font.c
  68. +++ b/grub-core/font/font.c
  69. @@ -461,7 +461,7 @@ grub_font_load (const char *filename)
  70. if (!prefix)
  71. {
  72. - grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "prefix");
  73. + grub_errno = GRUB_ERR_FILE_NOT_FOUND;
  74. goto fail;
  75. }
  76. file = try_open_from_prefix (prefix, filename);
  77. diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
  78. index 4011e2d15..af3bd00d0 100644
  79. --- a/grub-core/kern/dl.c
  80. +++ b/grub-core/kern/dl.c
  81. @@ -758,7 +758,7 @@ grub_dl_load (const char *name)
  82. return 0;
  83. if (! grub_dl_dir) {
  84. - grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "prefix");
  85. + grub_errno = GRUB_ERR_FILE_NOT_FOUND;
  86. return 0;
  87. }
  88. --
  89. 2.39.2