2009-12-21 Andreas Born <futur.andy@googlemail.com>

* kern/env.c (grub_env_export): Create nonexistent variables before
	exporting.
This commit is contained in:
Andreas Born 2009-12-21 15:20:12 +01:00 committed by Vladimir 'phcoder' Serbinenko
parent 7f39d92f8d
commit 0175d51f49
2 changed files with 16 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2009-12-21 Andreas Born <futur.andy@googlemail.com>
* kern/env.c (grub_env_export): Create nonexistent variables before
exporting.
2009-12-20 Carles Pina i Estany <carles@pina.cat> 2009-12-20 Carles Pina i Estany <carles@pina.cat>
* include/grub/auth.h: Include `<grub/i18n.h>'. * include/grub/auth.h: Include `<grub/i18n.h>'.

View file

@ -170,7 +170,15 @@ grub_env_export (const char *name)
struct grub_env_var *var; struct grub_env_var *var;
var = grub_env_find (name); var = grub_env_find (name);
if (var) if (! var)
{
grub_err_t err;
err = grub_env_set (name, "");
if (err)
return err;
var = grub_env_find (name);
}
var->type = GRUB_ENV_VAR_GLOBAL; var->type = GRUB_ENV_VAR_GLOBAL;
return GRUB_ERR_NONE; return GRUB_ERR_NONE;