]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Fix error-handling.
authorBruno Haible <bruno@clisp.org>
Fri, 19 Aug 2005 11:53:15 +0000 (11:53 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:12:47 +0000 (12:12 +0200)
gettext-runtime/intl/ChangeLog
gettext-runtime/intl/localealias.c

index ccc4af613a8c97e14acbc63cdaa23e40b58aea0e..c09a26bef8f43ddc9810ecf1dc2934ef614c93fd 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-19  Bruno Haible  <bruno@clisp.org>
+
+       * localealias.c (read_alias_file): In case of failure, close the
+       file descriptor and sort the array before returning.
+
 2005-08-19  Bruno Haible  <bruno@clisp.org>
 
        * localealias.c (read_alias_file) [IN_LIBGLOCALE]: Ignore aliases
index 89fe06b054f691bff530611e8ef17c09501cffea..26122a01189c4ab44d1abce3ad5d5edc22db0d0c 100644 (file)
@@ -319,7 +319,7 @@ read_alias_file (const char *fname, int fname_len)
 
                  if (nmap >= maxmap)
                    if (__builtin_expect (extend_alias_table (), 0))
-                     return added;
+                     goto out;
 
                  alias_len = strlen (alias) + 1;
                  value_len = strlen (value) + 1;
@@ -332,7 +332,7 @@ read_alias_file (const char *fname, int fname_len)
                                            ? alias_len + value_len : 1024));
                      char *new_pool = (char *) realloc (string_space, new_size);
                      if (new_pool == NULL)
-                       return added;
+                       goto out;
 
                      if (__builtin_expect (string_space != new_pool, 0))
                        {
@@ -374,6 +374,7 @@ read_alias_file (const char *fname, int fname_len)
        while (strchr (buf, '\n') == NULL);
     }
 
+ out:
   /* Should we test for ferror()?  I think we have to silently ignore
      errors.  --drepper  */
   fclose (fp);