From: Andreas Born <futur.andy@googlemail.com>
To: GRUB2 Devel <grub-devel@gnu.org>
Subject: [PATCH] create variables when exporting them
Date: Thu, 15 Oct 2009 20:40:37 +0200 [thread overview]
Message-ID: <4AD76CA5.3070102@googlemail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 372 bytes --]
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 <futur.andy@googlemail.com>
* kern/env.c (grub_env_export): Create inexistent variables
before exporting.
[-- Attachment #2: export-create.diff --]
[-- Type: text/x-patch, Size: 486 bytes --]
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;
}
next reply other threads:[~2009-10-15 18:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-15 18:40 Andreas Born [this message]
2009-10-15 19:16 ` [PATCH] create variables when exporting them Colin Watson
2009-10-15 19:52 ` Andreas Born
2009-12-06 22:57 ` Andreas Born
2009-12-15 18:20 ` Andreas Born
2009-12-21 14:21 ` Vladimir 'φ-coder/phcoder' Serbinenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AD76CA5.3070102@googlemail.com \
--to=futur.andy@googlemail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.