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

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