]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
glibc 2003-06-18 Ulrich Drepper <drepper@redhat.com>
authorBruno Haible <bruno@clisp.org>
Tue, 10 May 2005 11:48:44 +0000 (11:48 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:12:34 +0000 (12:12 +0200)
gettext-runtime/intl/ChangeLog
gettext-runtime/intl/localealias.c

index a5a6b8cb3eceeb0dd42156c3d2e0ede696cdc5bc..da303d01436f5c0edd3eb5892e5f4540aa6adb84 100644 (file)
@@ -1,3 +1,8 @@
+2003-06-18  Ulrich Drepper  <drepper@redhat.com>
+
+       * localealias.c (read_alias_file): Determine whether line is read
+       incompletely early, before we modify the line.
+
 2005-05-05  Bruno Haible  <bruno@clisp.org>
 
        * hash-string.h (__hash_string): Define differently outside glibc.
index 2eaf8813ed3ba80da38b847e5b71637a0e02eee0..c05fbc7f460caad85a50b40916ea7eb72f29f307 100644 (file)
@@ -254,11 +254,15 @@ read_alias_file (const char *fname, int fname_len)
       char *alias;
       char *value;
       char *cp;
+      int complete_line;
 
       if (FGETS (buf, sizeof buf, fp) == NULL)
        /* EOF reached.  */
        break;
 
+      /* Determine whether the line is complete.  */
+      complete_line = strchr (buf, '\n') != NULL;
+
       cp = buf;
       /* Ignore leading white space.  */
       while (isspace ((unsigned char) cp[0]))
@@ -345,11 +349,13 @@ read_alias_file (const char *fname, int fname_len)
 
       /* 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;
+      if (! complete_line)
+       do
+         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;
+       while (strchr (buf, '\n') == NULL);
     }
 
   /* Should we test for ferror()?  I think we have to silently ignore