Blame SOURCES/0172-Introduce-function-grub_debug_is_enabled-void-return.patch

5593c8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
5593c8
From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@redhat.com>
5593c8
Date: Mon, 25 Nov 2019 09:29:53 +0100
5593c8
Subject: [PATCH] Introduce function grub_debug_is_enabled(void) returning 1 if
5593c8
 'debug' is in the environment and not empty
5593c8
MIME-Version: 1.0
5593c8
Content-Type: text/plain; charset=UTF-8
5593c8
Content-Transfer-Encoding: 8bit
5593c8
5593c8
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
5593c8
---
5593c8
 grub-core/kern/misc.c | 13 +++++++++++++
5593c8
 include/grub/misc.h   |  1 +
5593c8
 2 files changed, 14 insertions(+)
5593c8
5593c8
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
d3c3ab
index 9f54b6b7d2d..a186ad3dd41 100644
5593c8
--- a/grub-core/kern/misc.c
5593c8
+++ b/grub-core/kern/misc.c
5593c8
@@ -163,6 +163,19 @@ int grub_err_printf (const char *fmt, ...)
5593c8
 __attribute__ ((alias("grub_printf")));
5593c8
 #endif
5593c8
 
5593c8
+/* Return 1 if 'debug' is set and not empty */
5593c8
+int
5593c8
+grub_debug_is_enabled (void)
5593c8
+{
5593c8
+  const char *debug;
5593c8
+
5593c8
+  debug = grub_env_get ("debug");
5593c8
+  if (!debug || debug[0] == '\0')
5593c8
+    return 0;
5593c8
+
5593c8
+  return 1;
5593c8
+}
5593c8
+
5593c8
 int
5593c8
 grub_debug_enabled (const char * condition)
5593c8
 {
5593c8
diff --git a/include/grub/misc.h b/include/grub/misc.h
d3c3ab
index 3adc4036e3b..6c4aa85ac50 100644
5593c8
--- a/include/grub/misc.h
5593c8
+++ b/include/grub/misc.h
5593c8
@@ -340,6 +340,7 @@ grub_puts (const char *s)
5593c8
 }
5593c8
 
5593c8
 int EXPORT_FUNC(grub_puts_) (const char *s);
5593c8
+int EXPORT_FUNC(grub_debug_is_enabled) (void);
5593c8
 int EXPORT_FUNC(grub_debug_enabled) (const char *condition);
5593c8
 void EXPORT_FUNC(grub_real_dprintf) (const char *file,
5593c8
                                      const int line,