2010-01-07 Robert Millan <rmh.grub@aybabtu.com>

Merge prefix-redefinition-fix branch.
	
	* normal/autofs.c (read_fs_list): Make function capable of being
	run multiple times, gracefuly replacing the previous data
	structures.
	* normal/dyncmd.c (read_command_list): Likewise.
	* normal/handler.c (read_handler_list): Likewise.
	* normal/main.c (read_lists): New function.  Calls all the
	list reading functions.
	(grub_normal_execute): Use read_lists() instead of calling all
	list reading functions explicitly.  Register read_lists() as a
	variable hook attached to ${prefix}.
This commit is contained in:
Robert Millan 2010-01-07 00:52:56 +00:00
commit e2e936b2f2
5 changed files with 65 additions and 22 deletions

View file

@ -63,12 +63,6 @@ void
read_command_list (void)
{
const char *prefix;
static int first_time = 1;
/* Make sure that this function does not get executed twice. */
if (! first_time)
return;
first_time = 0;
prefix = grub_env_get ("prefix");
if (prefix)
@ -85,6 +79,16 @@ read_command_list (void)
if (file)
{
char *buf = NULL;
/* Override previous commands.lst. */
while (grub_command_list)
{
grub_command_t tmp;
tmp = grub_command_list->next;
grub_free (grub_command_list);
grub_command_list = tmp;
}
for (;; grub_free (buf))
{
char *p, *name, *modname;