This patch updates list_variables() so that it also prints entries from
the external environment block when one is present. The function first
lists all variables from the file based envblk, then iterates over the
external envblk and prints those as well.

The output format remains the same as before. The change makes it
possible to inspect variables regardless of whether they are stored in
the file envblk or in the reserved block.

Signed-off-by: Michael Chang <[email protected]>
Reviewed-by: Neal Gompa <[email protected]>
Reviewed-by: Avnish Chouhan <[email protected]>
Reviewed-by: Sudhakar Kuppusamy <[email protected]>
Reviewed-by: Daniel Kiper <[email protected]>
---
 util/grub-editenv.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/util/grub-editenv.c b/util/grub-editenv.c
index 7f39ff120..f8fa294d8 100644
--- a/util/grub-editenv.c
+++ b/util/grub-editenv.c
@@ -355,10 +355,17 @@ static void
 list_variables (const char *name)
 {
   grub_envblk_t envblk;
+  grub_envblk_t envblk_on_block = NULL;
 
   envblk = open_envblk_file (name);
+  grub_envblk_iterate (envblk, &envblk_on_block, read_env_block_var);
   grub_envblk_iterate (envblk, NULL, print_var);
   grub_envblk_close (envblk);
+  if (envblk_on_block != NULL)
+    {
+      grub_envblk_iterate (envblk_on_block, NULL, print_var);
+      grub_envblk_close (envblk_on_block);
+    }
 }
 
 static void
-- 
2.51.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to