This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Re: read_alias_line discards every second entry


On Wed, Jun 18, Thorsten Kukuk wrote:

> 
> Hi,
> 
> the read_alias_file() function in intl/localealias.c discards every
> second entry. The reason is the following code:
> 
>       /* Possibly not the whole line fits into the buffer.  Ignore
> 	 the rest of the line.  */
>       while (strchr (buf, '\n') == NULL)
> 	if (FGETS (buf, sizeof buf, fp) == NULL)
> 	  /* Make sure the inner loop will be left.  The outer loop
> 	     will exit at the `feof' test.  */
> 	  break;
> 
> We write two '\0' into "buf" before we execute this code, one after
> every token. So buf contains something like: "alias\0\tvalue\0\n".
> 
> strchr will always exit after the first '\0' and always reads the
> next line of the file. So every second entry is ignored.

The appended Patch moves the read of the rest of the line back to
the beginning of the loop. Now all locales works again.

  Thorsten

-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/        kukuk@suse.de
SuSE Linux AG        Deutschherrnstr. 15-19        D-90429 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B

Attachment: glibc-2.3.localealias_revert.diff
Description: Text document

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]