* inet/getnameinfo.c (getnameinfo): For AF_INET, check errno cvs/fedora-glibc-20060828T1903
authorUlrich Drepper <drepper@redhat.com>
Mon, 28 Aug 2006 16:24:10 +0000 (16:24 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 28 Aug 2006 16:24:10 +0000 (16:24 +0000)
only if herrno is NETDB_INTERNAL.  Handle errors other than
ERANGE outside of the loops, handle TRY_AGAIN.

* locale/programs/ld-ctype.c (translit_flatten): Issue error
if other's ctype category was missing.
* locale/programs/ld-collate.c (collate_read): Return if
copy_locale's collate category is missing.

ChangeLog
inet/getnameinfo.c
locale/programs/ld-collate.c
locale/programs/ld-ctype.c

index 3975e02..2f46b1e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2006-08-28  Jakub Jelinek  <jakub@redhat.com>
+
+       * inet/getnameinfo.c (getnameinfo): For AF_INET, check errno
+       only if herrno is NETDB_INTERNAL.  Handle errors other than
+       ERANGE outside of the loops, handle TRY_AGAIN.
+
+       * locale/programs/ld-ctype.c (translit_flatten): Issue error
+       if other's ctype category was missing.
+       * locale/programs/ld-collate.c (collate_read): Return if
+       copy_locale's collate category is missing.
+
 2006-08-27  Ulrich Drepper  <drepper@redhat.com>
 
        [BZ #2684]
index 5057fd2..b7b2b15 100644 (file)
@@ -203,48 +203,40 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
        if (!(flags & NI_NUMERICHOST))
          {
            struct hostent *h = NULL;
+           if (sa->sa_family == AF_INET6)
+             {
+               while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in6 *) sa)->sin6_addr),
+                                         sizeof(struct in6_addr),
+                                         AF_INET6, &th, tmpbuf, tmpbuflen,
+                                         &h, &herrno))
+                 if (herrno == NETDB_INTERNAL && errno == ERANGE)
+                   tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen);
+                 else
+                   break;
+             }
+           else
+             {
+               while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in *)sa)->sin_addr),
+                                         sizeof(struct in_addr), AF_INET,
+                                         &th, tmpbuf, tmpbuflen,
+                                         &h, &herrno))
+                 if (herrno == NETDB_INTERNAL && errno == ERANGE)
+                   tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen);
+                 else
+                   break;
+             }
+
            if (h == NULL)
              {
-               if (sa->sa_family == AF_INET6)
+               if (herrno == NETDB_INTERNAL)
                  {
-                   while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in6 *) sa)->sin6_addr),
-                                             sizeof(struct in6_addr),
-                                             AF_INET6, &th, tmpbuf, tmpbuflen,
-                                             &h, &herrno))
-                     {
-                       if (herrno == NETDB_INTERNAL)
-                         {
-                           if (errno == ERANGE)
-                             tmpbuf = extend_alloca (tmpbuf, tmpbuflen,
-                                                     2 * tmpbuflen);
-                           else
-                             {
-                               __set_h_errno (herrno);
-                               __set_errno (serrno);
-                               return EAI_SYSTEM;
-                             }
-                         }
-                       else
-                         {
-                           break;
-                         }
-                     }
+                   __set_h_errno (herrno);
+                   return EAI_SYSTEM;
                  }
-               else
+               if (herrno == TRY_AGAIN)
                  {
-                   while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in *)sa)->sin_addr),
-                                             sizeof(struct in_addr), AF_INET,
-                                             &th, tmpbuf, tmpbuflen,
-                                             &h, &herrno))
-                     {
-                       if (errno == ERANGE)
-                         tmpbuf = extend_alloca (tmpbuf, tmpbuflen,
-                                                 2 * tmpbuflen);
-                       else
-                         {
-                           break;
-                         }
-                     }
+                   __set_h_errno (herrno);
+                   return EAI_AGAIN;
                  }
              }
 
@@ -361,10 +353,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
                                 (const void *) &(((const struct sockaddr_in *) sa)->sin_addr),
                                 host, hostlen);
                if (c == NULL)
-                 {
-                   __set_errno (serrno);
-                   return EAI_SYSTEM;
-                 }
+                 return EAI_SYSTEM;
              }
            ok = 1;
          }
index 66638d5..e69ac85 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2002, 2003, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2002, 2003, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
 
@@ -2671,6 +2671,9 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
              if (locfile_read (copy_locale, charmap) != 0)
                goto skip_category;
            }
+
+         if (copy_locale->categories[LC_COLLATE].collate == NULL)
+           return;
        }
 
       lr_ignore_rest (ldfile, 1);
index a42b6f1..b1a28b9 100644 (file)
@@ -3769,7 +3769,7 @@ translit_flatten (struct locale_ctype_t *ctype,
 
       other = find_locale (LC_CTYPE, copy_locale, copy_repertoire, charmap);
 
-      if (other == NULL)
+      if (other == NULL || other->categories[LC_CTYPE].ctype == NULL)
        {
          WITH_CUR_LOCALE (error (0, 0, _("\
 %s: transliteration data from locale `%s' not available"),