[miroslav.holcak@vitkovice.cz] libc/1588: Problem with locale
Andreas Jaeger
aj@suse.de
Tue Feb 8 06:15:00 GMT 2000
Hi,
I'm appending a patch for PR libc/1588. The problem is that after a line
full of whitespace (\n is whitespace for isspace) has been parsed the
following line in locale.alias is thrown away.
In case of an empty line (or one full of whitespace) cp points at the
final \0 in line 382 - and then the while loop in line 421 ignores the
next line :-(.
I'm appending a patch which should fix this problem but asks other to
double check this.
The patch is against glibc 2.2 - but should apply also against 2.1.
Andreas
2000-02-08 Andreas Jaeger <aj@suse.de>
* locale/programs/locale.c (write_locales): Fix handling of
whitespace lines.
Fixes PR libc/1588, reported by Miroslav Holcak
<miroslav.holcak@vitkovice.cz>.
============================================================
Index: locale/programs/locale.c
--- locale/programs/locale.c 1999/11/18 16:25:01 1.28
+++ locale/programs/locale.c 2000/02/08 14:07:27
@@ -1,5 +1,5 @@
/* Implementation of the locale program according to POSIX 9945-2.
- Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
@@ -376,11 +376,11 @@
cp = buf;
/* Ignore leading white space. */
- while (isspace (cp[0]))
+ while (isspace (cp[0]) && cp[0] != '\n')
++cp;
/* A leading '#' signals a comment line. */
- if (cp[0] != '\0' && cp[0] != '#')
+ if (cp[0] != '\0' && cp[0] != '#' && cp[0] != '\n')
{
alias = cp++;
while (cp[0] != '\0' && !isspace (cp[0]))
More information about the Libc-alpha
mailing list