Fix endless loop in localedef.

localedef got into an endless loop in case order_start was used for
the unnamed_section twice and the first use didn't actually result
into any definition.
This commit is contained in:
Ulrich Drepper 2009-09-07 02:32:29 -07:00
parent d76da20f7f
commit 7a7e49c020
2 changed files with 35 additions and 28 deletions

View File

@ -1,5 +1,9 @@
2009-09-07 Ulrich Drepper <drepper@redhat.com>
* locale/programs/ld-collate.c (struct locale_collate_t): Add
unnamed_section_defined field.
(collate_read): Test and set unnamed_section_defined.
* posix/getconf.c (vars): Handle POSIX2_LINE_MAX in addition to
_POSIX2_LINE_MAX.

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1995-2003, 2005-2007, 2008 Free Software Foundation, Inc.
/* Copyright (C) 1995-2003, 2005-2008, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
@ -203,6 +203,8 @@ struct locale_collate_t
struct section_list *current_section;
/* There always can be an unnamed section. */
struct section_list unnamed_section;
/* Flag whether the unnamed section has been defined. */
bool unnamed_section_defined;
/* To make handling of errors easier we have another section. */
struct section_list error_section;
/* Sometimes we are defining the values for collating symbols before
@ -3349,7 +3351,7 @@ error while adding equivalent collating symbol"));
section. */
collate->current_section = &collate->unnamed_section;
if (collate->unnamed_section.first != NULL)
if (collate->unnamed_section_defined)
lr_error (ldfile, _("\
%s: multiple order definitions for unnamed section"),
"LC_COLLATE");
@ -3359,6 +3361,7 @@ error while adding equivalent collating symbol"));
the collate->sections list. */
collate->unnamed_section.next = collate->sections;
collate->sections = &collate->unnamed_section;
collate->unnamed_section_defined = true;
}
}