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]

read_alias_line discards every second entry


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.

This was changed between glibc 2.2 and 2.3 with the following
changelog:

2002-11-19  Ulrich Drepper  <drepper@redhat.com>

        * intl/localealias.c (read_alias_file): Use only about 400 bytes
        of stack space instead of 16k.


  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: 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]