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

@ -135,7 +135,6 @@ void
read_handler_list (void)
{
const char *prefix;
static int first_time = 1;
const char *class_name;
auto int iterate_handler (grub_handler_t handler);
@ -162,11 +161,6 @@ read_handler_list (void)
return 0;
}
/* Make sure that this function does not get executed twice. */
if (! first_time)
return;
first_time = 0;
prefix = grub_env_get ("prefix");
if (prefix)
{
@ -182,6 +176,16 @@ read_handler_list (void)
if (file)
{
char *buf = NULL;
/* Override previous handler.lst. */
while (grub_handler_class_list)
{
grub_handler_class_t tmp;
tmp = grub_handler_class_list->next;
grub_free (grub_handler_class_list);
grub_handler_class_list = tmp;
}
for (;; grub_free (buf))
{
char *p;