grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] create variables when exporting them


From: Andreas Born
Subject: [PATCH] create variables when exporting them
Date: Thu, 15 Oct 2009 20:40:37 +0200
User-agent: Thunderbird 2.0.0.23 (X11/20090827)

This patch changes grub_env_export to create variables with empty value, if necessary. This makes it possible to export variables before actually assigning them any value and is the way bash behaves.

Thanks
Andreas

ChangeLog:
2009-10-15  Andreas Born  <address@hidden>

* kern/env.c (grub_env_export): Create inexistent variables before exporting.
Index: kern/env.c
===================================================================
--- kern/env.c  (Revision 2631)
+++ kern/env.c  (Arbeitskopie)
@@ -170,8 +171,13 @@
   struct grub_env_var *var;
 
   var = grub_env_find (name);
-  if (var)
-    var->type = GRUB_ENV_VAR_GLOBAL;
+  if (! var)
+  {
+    if (grub_env_set (name, "") != GRUB_ERR_NONE)
+        return grub_errno;
+    var = grub_env_find (name);
+  }    
+  var->type = GRUB_ENV_VAR_GLOBAL;
 
   return GRUB_ERR_NONE;
 }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]