From: Bruno Haible Date: Tue, 10 May 2005 11:48:44 +0000 (+0000) Subject: glibc 2003-06-18 Ulrich Drepper X-Git-Tag: v0.15~527 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22b627642febb0eaf0b6646c5ec8f94b8e47bba5;p=thirdparty%2Fgettext.git glibc 2003-06-18 Ulrich Drepper --- diff --git a/gettext-runtime/intl/ChangeLog b/gettext-runtime/intl/ChangeLog index a5a6b8cb3..da303d014 100644 --- a/gettext-runtime/intl/ChangeLog +++ b/gettext-runtime/intl/ChangeLog @@ -1,3 +1,8 @@ +2003-06-18 Ulrich Drepper + + * localealias.c (read_alias_file): Determine whether line is read + incompletely early, before we modify the line. + 2005-05-05 Bruno Haible * hash-string.h (__hash_string): Define differently outside glibc. diff --git a/gettext-runtime/intl/localealias.c b/gettext-runtime/intl/localealias.c index 2eaf8813e..c05fbc7f4 100644 --- a/gettext-runtime/intl/localealias.c +++ b/gettext-runtime/intl/localealias.c @@ -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