This is the mail archive of the glibc-cvs@sourceware.org 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]

GNU C Library master sources branch, release/2.11/master, updated. glibc-2.11.1-4-g11c19d3


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, release/2.11/master has been updated
       via  11c19d374bd4458039d5f8e7e1548d3349bfa3d7 (commit)
       via  2dfab6cf7cfb7cb3b53537e809146a6dea186ec6 (commit)
       via  7b35a400cff11aa557b93c603fd8e7e0f74204a5 (commit)
       via  a4b737aa083bd422b15f6dc04b4ea35d18b111e9 (commit)
      from  3decedce640208c25323bca68c98381c640ab06f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=11c19d374bd4458039d5f8e7e1548d3349bfa3d7

commit 11c19d374bd4458039d5f8e7e1548d3349bfa3d7
Author: Paul Eggert <eggert@gnu.org>
Date:   Thu Jan 14 21:35:15 2010 -0800

    regcomp.c: do not ignore memory allocation failure
    
    (cherry picked from commit 21f5de55ec4fa5eba06060c40fed87aad2aecdee)

diff --git a/ChangeLog b/ChangeLog
index df018f2..17dbb62 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-01-14  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #11127]
+	* posix/regcomp.c (alc_eclosure_iter): Do not ignore
+	re_node_set_insert failure; return REG_ESPACE.
+	Patch by Paul Eggert.
+
 2010-01-06  Ulrich Drepper  <drepper@redhat.com>
 
 	* dirent/dirent.h: Fix typo in feature selection macro use.
diff --git a/posix/regcomp.c b/posix/regcomp.c
index 6966b5d..542b848 100644
--- a/posix/regcomp.c
+++ b/posix/regcomp.c
@@ -1,6 +1,5 @@
 /* Extended regular expression matching and search library.
-   Copyright (C) 2002,2003,2004,2005,2006,2007,2009
-   Free Software Foundation, Inc.
+   Copyright (C) 2002-2007,2009,2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
 
@@ -616,7 +615,7 @@ free_dfa_content (re_dfa_t *dfa)
 	    re_dfastate_t *state = entry->array[j];
 	    free_state (state);
 	  }
-        re_free (entry->array);
+	re_free (entry->array);
       }
   re_free (dfa->state_table);
 #ifdef RE_ENABLE_I18N
@@ -1066,8 +1065,8 @@ optimize_utf8 (re_dfa_t *dfa)
 	  }
 	break;
       case OP_PERIOD:
-        has_period = 1;
-        break;
+	has_period = 1;
+	break;
       case OP_BACK_REF:
       case OP_ALT:
       case END_OF_RE:
@@ -1080,7 +1079,7 @@ optimize_utf8 (re_dfa_t *dfa)
       case SIMPLE_BRACKET:
 	/* Just double check.  The non-ASCII range starts at 0x80.  */
 	assert (0x80 % BITSET_WORD_BITS == 0);
-        for (i = 0x80 / BITSET_WORD_BITS; i < BITSET_WORDS; ++i)
+	for (i = 0x80 / BITSET_WORD_BITS; i < BITSET_WORDS; ++i)
 	  if (dfa->nodes[node].opr.sbcset[i])
 	    return;
 	break;
@@ -1161,7 +1160,7 @@ analyze (regex_t *preg)
     {
       dfa->inveclosures = re_malloc (re_node_set, dfa->nodes_len);
       if (BE (dfa->inveclosures == NULL, 0))
-        return REG_ESPACE;
+	return REG_ESPACE;
       ret = calc_inveclosure (dfa);
     }
 
@@ -1183,16 +1182,16 @@ postorder (bin_tree_t *root, reg_errcode_t (fn (void *, bin_tree_t *)),
 	 if that's the only child).  */
       while (node->left || node->right)
 	if (node->left)
-          node = node->left;
-        else
-          node = node->right;
+	  node = node->left;
+	else
+	  node = node->right;
 
       do
 	{
 	  reg_errcode_t err = fn (extra, node);
 	  if (BE (err != REG_NOERROR, 0))
 	    return err;
-          if (node->parent == NULL)
+	  if (node->parent == NULL)
 	    return REG_NOERROR;
 	  prev = node;
 	  node = node->parent;
@@ -1226,7 +1225,7 @@ preorder (bin_tree_t *root, reg_errcode_t (fn (void *, bin_tree_t *)),
 	      prev = node;
 	      node = node->parent;
 	      if (!node)
-	        return REG_NOERROR;
+		return REG_NOERROR;
 	    }
 	  node = node->right;
 	}
@@ -1249,13 +1248,13 @@ optimize_subexps (void *extra, bin_tree_t *node)
     }
 
   else if (node->token.type == SUBEXP
-           && node->left && node->left->token.type == SUBEXP)
+	   && node->left && node->left->token.type == SUBEXP)
     {
       int other_idx = node->left->token.opr.idx;
 
       node->left = node->left->left;
       if (node->left)
-        node->left->parent = node;
+	node->left->parent = node;
 
       dfa->subexp_map[other_idx] = dfa->subexp_map[node->token.opr.idx];
       if (other_idx < BITSET_WORD_BITS)
@@ -1340,9 +1339,9 @@ calc_first (void *extra, bin_tree_t *node)
       node->first = node;
       node->node_idx = re_dfa_add_node (dfa, node->token);
       if (BE (node->node_idx == -1, 0))
-        return REG_ESPACE;
+	return REG_ESPACE;
       if (node->token.type == ANCHOR)
-        dfa->nodes[node->node_idx].constraint = node->token.opr.ctx_type;
+	dfa->nodes[node->node_idx].constraint = node->token.opr.ctx_type;
     }
   return REG_NOERROR;
 }
@@ -1364,7 +1363,7 @@ calc_next (void *extra, bin_tree_t *node)
       if (node->left)
 	node->left->next = node->next;
       if (node->right)
-        node->right->next = node->next;
+	node->right->next = node->next;
       break;
     }
   return REG_NOERROR;
@@ -1643,9 +1642,10 @@ static reg_errcode_t
 calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, int node, int root)
 {
   reg_errcode_t err;
-  int i, incomplete;
+  int i;
   re_node_set eclosure;
-  incomplete = 0;
+  int ret;
+  int incomplete = 0;
   err = re_node_set_alloc (&eclosure, dfa->edests[node].nelem + 1);
   if (BE (err != REG_NOERROR, 0))
     return err;
@@ -1700,8 +1700,10 @@ calc_eclosure_iter (re_node_set *new_set, re_dfa_t *dfa, int node, int root)
 	  }
       }
 
-  /* Epsilon closures include itself.  */
-  re_node_set_insert (&eclosure, node);
+  /* An epsilon closure includes itself.  */
+  ret = re_node_set_insert (&eclosure, node);
+  if (BE (ret < 0, 0))
+    return REG_ESPACE;
   if (incomplete && !root)
     dfa->eclosures[node].nelem = 0;
   else
@@ -2285,7 +2287,7 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token,
 	  && dfa->word_ops_used == 0)
 	init_word_char (dfa);
       if (token->opr.ctx_type == WORD_DELIM
-          || token->opr.ctx_type == NOT_WORD_DELIM)
+	  || token->opr.ctx_type == NOT_WORD_DELIM)
 	{
 	  bin_tree_t *tree_first, *tree_last;
 	  if (token->opr.ctx_type == WORD_DELIM)
@@ -2293,13 +2295,13 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token,
 	      token->opr.ctx_type = WORD_FIRST;
 	      tree_first = create_token_tree (dfa, NULL, NULL, token);
 	      token->opr.ctx_type = WORD_LAST;
-            }
-          else
-            {
+	    }
+	  else
+	    {
 	      token->opr.ctx_type = INSIDE_WORD;
 	      tree_first = create_token_tree (dfa, NULL, NULL, token);
 	      token->opr.ctx_type = INSIDE_NOTWORD;
-            }
+	    }
 	  tree_last = create_token_tree (dfa, NULL, NULL, token);
 	  tree = create_tree (dfa, tree_first, tree_last, OP_ALT);
 	  if (BE (tree_first == NULL || tree_last == NULL || tree == NULL, 0))
@@ -2410,7 +2412,7 @@ parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
     {
       tree = parse_reg_exp (regexp, preg, token, syntax, nest, err);
       if (BE (*err == REG_NOERROR && token->type != OP_CLOSE_SUBEXP, 0))
-        *err = REG_EPAREN;
+	*err = REG_EPAREN;
       if (BE (*err != REG_NOERROR, 0))
 	return NULL;
     }
@@ -2541,11 +2543,11 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
       elem = duplicate_tree (elem, dfa);
       tree = create_tree (dfa, tree, elem, CONCAT);
       if (BE (elem == NULL || tree == NULL, 0))
-        goto parse_dup_op_espace;
+	goto parse_dup_op_espace;
 
       tree = create_tree (dfa, tree, NULL, OP_ALT);
       if (BE (tree == NULL, 0))
-        goto parse_dup_op_espace;
+	goto parse_dup_op_espace;
     }
 
   if (old_tree)
@@ -2626,9 +2628,9 @@ build_range_exp (bitset_t sbcset, bracket_elem_t *start_elem,
        no MBCSET if dfa->mb_cur_max == 1.  */
     if (mbcset)
       {
-        /* Check the space of the arrays.  */
-        if (BE (*range_alloc == mbcset->nranges, 0))
-          {
+	/* Check the space of the arrays.  */
+	if (BE (*range_alloc == mbcset->nranges, 0))
+	  {
 	    /* There is not enough space, need realloc.  */
 	    wchar_t *new_array_start, *new_array_end;
 	    int new_nranges;
@@ -2638,9 +2640,9 @@ build_range_exp (bitset_t sbcset, bracket_elem_t *start_elem,
 	    /* Use realloc since mbcset->range_starts and mbcset->range_ends
 	       are NULL if *range_alloc == 0.  */
 	    new_array_start = re_realloc (mbcset->range_starts, wchar_t,
-				          new_nranges);
+					  new_nranges);
 	    new_array_end = re_realloc (mbcset->range_ends, wchar_t,
-				        new_nranges);
+					new_nranges);
 
 	    if (BE (new_array_start == NULL || new_array_end == NULL, 0))
 	      return REG_ESPACE;
@@ -2648,10 +2650,10 @@ build_range_exp (bitset_t sbcset, bracket_elem_t *start_elem,
 	    mbcset->range_starts = new_array_start;
 	    mbcset->range_ends = new_array_end;
 	    *range_alloc = new_nranges;
-          }
+	  }
 
-        mbcset->range_starts[mbcset->nranges] = start_wc;
-        mbcset->range_ends[mbcset->nranges++] = end_wc;
+	mbcset->range_starts[mbcset->nranges] = start_wc;
+	mbcset->range_ends[mbcset->nranges++] = end_wc;
       }
 
     /* Build the table for single byte characters.  */
@@ -2870,8 +2872,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
 	 build below suffices. */
       if (nrules > 0 || dfa->mb_cur_max > 1)
 	{
-          /* Check the space of the arrays.  */
-          if (BE (*range_alloc == mbcset->nranges, 0))
+	  /* Check the space of the arrays.  */
+	  if (BE (*range_alloc == mbcset->nranges, 0))
 	    {
 	      /* There is not enough space, need realloc.  */
 	      uint32_t *new_array_start;
@@ -2883,18 +2885,18 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
 	      new_array_start = re_realloc (mbcset->range_starts, uint32_t,
 					    new_nranges);
 	      new_array_end = re_realloc (mbcset->range_ends, uint32_t,
-				          new_nranges);
+					  new_nranges);
 
 	      if (BE (new_array_start == NULL || new_array_end == NULL, 0))
-	        return REG_ESPACE;
+		return REG_ESPACE;
 
 	      mbcset->range_starts = new_array_start;
 	      mbcset->range_ends = new_array_end;
 	      *range_alloc = new_nranges;
 	    }
 
-          mbcset->range_starts[mbcset->nranges] = start_collseq;
-          mbcset->range_ends[mbcset->nranges++] = end_collseq;
+	  mbcset->range_starts[mbcset->nranges] = start_collseq;
+	  mbcset->range_ends[mbcset->nranges++] = end_collseq;
 	}
 
       /* Build the table for single byte characters.  */
@@ -3227,17 +3229,17 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
 	 of having both SIMPLE_BRACKET and COMPLEX_BRACKET.  */
       if (sbc_idx < BITSET_WORDS)
 	{
-          /* Build a tree for simple bracket.  */
-          br_token.type = SIMPLE_BRACKET;
-          br_token.opr.sbcset = sbcset;
-          work_tree = create_token_tree (dfa, NULL, NULL, &br_token);
-          if (BE (work_tree == NULL, 0))
-            goto parse_bracket_exp_espace;
+	  /* Build a tree for simple bracket.  */
+	  br_token.type = SIMPLE_BRACKET;
+	  br_token.opr.sbcset = sbcset;
+	  work_tree = create_token_tree (dfa, NULL, NULL, &br_token);
+	  if (BE (work_tree == NULL, 0))
+	    goto parse_bracket_exp_espace;
 
-          /* Then join them by ALT node.  */
-          work_tree = create_tree (dfa, work_tree, mbc_tree, OP_ALT);
-          if (BE (work_tree == NULL, 0))
-            goto parse_bracket_exp_espace;
+	  /* Then join them by ALT node.  */
+	  work_tree = create_tree (dfa, work_tree, mbc_tree, OP_ALT);
+	  if (BE (work_tree == NULL, 0))
+	    goto parse_bracket_exp_espace;
 	}
       else
 	{
@@ -3256,7 +3258,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
       br_token.opr.sbcset = sbcset;
       work_tree = create_token_tree (dfa, NULL, NULL, &br_token);
       if (BE (work_tree == NULL, 0))
-        goto parse_bracket_exp_espace;
+	goto parse_bracket_exp_espace;
     }
   return work_tree;
 
@@ -3809,7 +3811,7 @@ duplicate_tree (const bin_tree_t *root, re_dfa_t *dfa)
 	      node = node->parent;
 	      dup_node = dup_node->parent;
 	      if (!node)
-	        return dup_root;
+		return dup_root;
 	    }
 	  node = node->right;
 	  p_new = &dup_node->right;

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=2dfab6cf7cfb7cb3b53537e809146a6dea186ec6

commit 2dfab6cf7cfb7cb3b53537e809146a6dea186ec6
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Wed Jan 6 22:47:31 2010 -0800

    Fix typo in feature selection macro use.
    
    (cherry picked from commit 44dcc00292b965b3b6bff8415175d6a3e290aab7)

diff --git a/ChangeLog b/ChangeLog
index e5d41e6..df018f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-01-06  Ulrich Drepper  <drepper@redhat.com>
+
+	* dirent/dirent.h: Fix typo in feature selection macro use.
+
 2009-12-15  Ulrich Drepper  <drepper@redhat.com>
 
 	* include/link.h (struct link_map): Move l_used into its own word.
diff --git a/dirent/dirent.h b/dirent/dirent.h
index 369ccdc..675deae 100644
--- a/dirent/dirent.h
+++ b/dirent/dirent.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2000, 2003-2005, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2000,2003-2005,2009,2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -218,7 +218,7 @@ extern void seekdir (DIR *__dirp, long int __pos) __THROW __nonnull ((1));
 extern long int telldir (DIR *__dirp) __THROW __nonnull ((1));
 #endif
 
-#if defined __USE_BSD || defined __USE_MISC || defined __XOPEN_2K8
+#if defined __USE_BSD || defined __USE_MISC || defined __XOPEN2K8
 
 /* Return the file descriptor used by DIRP.  */
 extern int dirfd (DIR *__dirp) __THROW __nonnull ((1));

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=7b35a400cff11aa557b93c603fd8e7e0f74204a5

commit 7b35a400cff11aa557b93c603fd8e7e0f74204a5
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Tue Dec 15 12:32:27 2009 -0800

    Avoid ELF lookup race.
    
    On some architectures the update of the l_used field in the lookup
    functions races with setting the other bits in the bitfield.  Simply
    avoid this and optimize use of l_used in general.
    
    (cherry picked from commit 2af6396817fb9df98e63de75dd59fd999ee9f1d0)

diff --git a/ChangeLog b/ChangeLog
index 3ac31e7..e5d41e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-12-15  Ulrich Drepper  <drepper@redhat.com>
+
+	* include/link.h (struct link_map): Move l_used into its own word.
+	* elf/dl-lookup.c (_dl_lookup_symbol_x): Only update l_used when it is
+	still zero.
+	* elf/dl-object.c (_dl_new_object): Set dl_used if we know it is
+	never really used.
+
 2009-12-10  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #11000]
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index c1a1366..763ec16 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -777,7 +777,7 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
   if (__builtin_expect (protected != 0, 0))
     {
       /* It is very tricky.  We need to figure out what value to
-         return for the protected symbol.  */
+	 return for the protected symbol.  */
       if (type_class == ELF_RTYPE_CLASS_PLT)
 	{
 	  if (current_value.s != NULL && current_value.m != undef_map)
@@ -822,7 +822,8 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
 				  version, type_class, flags, skip_map);
 
   /* The object is used.  */
-  current_value.m->l_used = 1;
+  if (__builtin_expect (current_value.m->l_used == 0, 0))
+    current_value.m->l_used = 1;
 
   if (__builtin_expect (GLRO(dl_debug_mask)
 			& (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK), 0))
@@ -844,7 +845,7 @@ _dl_setup_hash (struct link_map *map)
   Elf_Symndx nchain;
 
   if (__builtin_expect (map->l_info[DT_ADDRTAGIDX (DT_GNU_HASH) + DT_NUM
-  				    + DT_THISPROCNUM + DT_VERSIONTAGNUM
+				    + DT_THISPROCNUM + DT_VERSIONTAGNUM
 				    + DT_EXTRANUM + DT_VALNUM] != NULL, 1))
     {
       Elf32_Word *hash32
diff --git a/elf/dl-object.c b/elf/dl-object.c
index be4ea38..788e2c0 100644
--- a/elf/dl-object.c
+++ b/elf/dl-object.c
@@ -1,5 +1,5 @@
 /* Storage management for the chain of loaded shared objects.
-   Copyright (C) 1995-2002,2004,2006,2007,2008 Free Software Foundation, Inc.
+   Copyright (C) 1995-2002,2004,2006-2008,2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -67,6 +67,10 @@ _dl_new_object (char *realname, const char *libname, int type,
 
   new->l_name = realname;
   new->l_type = type;
+  /* If we set the bit now since we know it is never used we avoid
+     dirtying the cache line later.  */
+  if ((GLRO(dl_debug_mask) & DL_DEBUG_UNUSED) == 0)
+    new->l_used = 1;
   new->l_loader = loader;
 #if NO_TLS_OFFSET != 0
   new->l_tls_offset = NO_TLS_OFFSET;
@@ -174,7 +178,7 @@ _dl_new_object (char *realname, const char *libname, int type,
 	  if (result == NULL)
 	    {
 	      /* We were not able to determine the current directory.
-	         Note that free(origin) is OK if origin == NULL.  */
+		 Note that free(origin) is OK if origin == NULL.  */
 	      free (origin);
 	      origin = (char *) -1;
 	      goto out;
diff --git a/include/link.h b/include/link.h
index 4b9978a..26c6743 100644
--- a/include/link.h
+++ b/include/link.h
@@ -1,6 +1,6 @@
 /* Data structure for communication from the run-time dynamic linker for
    loaded ELF shared objects.
-   Copyright (C) 1995-2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1995-2006, 2007, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -180,7 +180,6 @@ struct link_map
     unsigned int l_need_tls_init:1; /* Nonzero if GL(dl_init_static_tls)
 				       should be called on this link map
 				       when relocation finishes.  */
-    unsigned int l_used:1;	/* Nonzero if the DSO is used.  */
     unsigned int l_auditing:1;	/* Nonzero if the DSO is used in auditing.  */
     unsigned int l_audit_any_plt:1; /* Nonzero if at least one audit module
 				       is interested in the PLT interception.*/
@@ -239,12 +238,15 @@ struct link_map
     struct link_map **l_initfini;
 
     /* List of the dependencies introduced through symbol binding.  */
-    unsigned int l_reldepsmax;
     struct link_map_reldeps
       {
 	unsigned int act;
 	struct link_map *list[];
       } *l_reldeps;
+    unsigned int l_reldepsmax;
+
+    /* Nonzero if the DSO is used.  */
+    unsigned int l_used;
 
     /* Various flag words.  */
     ElfW(Word) l_feature_1;

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a4b737aa083bd422b15f6dc04b4ea35d18b111e9

commit a4b737aa083bd422b15f6dc04b4ea35d18b111e9
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Thu Dec 10 15:44:26 2009 -0800

    Fix a few error cases in *name4_r lookup handling.
    
    (cherry picked from commit a682a1bf553b1efe4dbb03207fece5b719cec482)

diff --git a/ChangeLog b/ChangeLog
index 25b96ae..3ac31e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2009-12-10  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #11000]
+	* nis/nss_nis/nis-hosts.c (_nss_nis_gethostbyname4_r): Always set
+	*herrnop before returning.
+	* nis/nss_nisplus/nisplus-hosts.c (internal_gethostbyname2_r):
+	Likewise.
+	* nss/nss_files/files-hosts.c (_nss_files_gethostbyname4_r): Handle
+	TRYAGAIN errors separately.
+	* sysdeps/posix/getaddrinfo.c (gaih_inet): Fix error handling of
+	*name4_r after functions.
+
 2009-11-24  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/unix/grantpt.c (grantpt): Use CLOSE_ALL_FDS is available
diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c
index e1db5f5..18bc773 100644
--- a/nis/nss_nis/nis-hosts.c
+++ b/nis/nss_nis/nis-hosts.c
@@ -70,20 +70,20 @@ LINE_PARSER
      {
        assert ((flags & AI_V4MAPPED) == 0 || af != AF_UNSPEC);
        if (flags & AI_V4MAPPED)
-         {
-           map_v4v6_address ((char *) entdata->host_addr,
-                             (char *) entdata->host_addr);
-           result->h_addrtype = AF_INET6;
-           result->h_length = IN6ADDRSZ;
-         }
+	 {
+	   map_v4v6_address ((char *) entdata->host_addr,
+			     (char *) entdata->host_addr);
+	   result->h_addrtype = AF_INET6;
+	   result->h_length = IN6ADDRSZ;
+	 }
        else
-         {
-           result->h_addrtype = AF_INET;
-           result->h_length = INADDRSZ;
-         }
+	 {
+	   result->h_addrtype = AF_INET;
+	   result->h_length = INADDRSZ;
+	 }
      }
    else if (af != AF_INET
-            && inet_pton (AF_INET6, addr, entdata->host_addr) > 0)
+	    && inet_pton (AF_INET6, addr, entdata->host_addr) > 0)
      {
        result->h_addrtype = AF_INET6;
        result->h_length = IN6ADDRSZ;
@@ -164,14 +164,14 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
       int keylen;
       int yperr;
       if (new_start)
-        yperr = yp_first (domain, "hosts.byname", &outkey, &keylen, &result,
+	yperr = yp_first (domain, "hosts.byname", &outkey, &keylen, &result,
 			  &len);
       else
-        yperr = yp_next (domain, "hosts.byname", oldkey, oldkeylen, &outkey,
+	yperr = yp_next (domain, "hosts.byname", oldkey, oldkeylen, &outkey,
 			 &keylen, &result, &len);
 
       if (__builtin_expect (yperr != YPERR_SUCCESS, 0))
-        {
+	{
 	  enum nss_status retval = yperr2nss (yperr);
 
 	  switch (retval)
@@ -191,12 +191,12 @@ internal_nis_gethostent_r (struct hostent *host, char *buffer,
 	}
 
       if (__builtin_expect ((size_t) (len + 1) > linebuflen, 0))
-        {
-          free (result);
+	{
+	  free (result);
 	  *h_errnop = NETDB_INTERNAL;
-          *errnop = ERANGE;
-          return NSS_STATUS_TRYAGAIN;
-        }
+	  *errnop = ERANGE;
+	  return NSS_STATUS_TRYAGAIN;
+	}
 
       char *p = strncpy (data->linebuffer, result, len);
       data->linebuffer[len] = '\0';
@@ -233,7 +233,7 @@ _nss_nis_gethostent_r (struct hostent *host, char *buffer, size_t buflen,
   __libc_lock_lock (lock);
 
   status = internal_nis_gethostent_r (host, buffer, buflen, errnop, h_errnop,
-		        ((_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET),
+			((_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET),
 			((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0 ));
 
   __libc_lock_unlock (lock);
@@ -346,7 +346,7 @@ _nss_nis_gethostbyname2_r (const char *name, int af, struct hostent *host,
 
   return internal_gethostbyname2_r (name, af, host, buffer, buflen, errnop,
 				    h_errnop,
-		        ((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0));
+			((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0));
 }
 
 
@@ -456,7 +456,10 @@ _nss_nis_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
 {
   char *domain;
   if (yp_get_default_domain (&domain))
-    return NSS_STATUS_UNAVAIL;
+    {
+      *herrnop = NO_DATA;
+      return NSS_STATUS_UNAVAIL;
+    }
 
   /* Convert name to lowercase.  */
   size_t namlen = strlen (name);
diff --git a/nis/nss_nisplus/nisplus-hosts.c b/nis/nss_nisplus/nisplus-hosts.c
index 37d4477..eca64c9 100644
--- a/nis/nss_nisplus/nisplus-hosts.c
+++ b/nis/nss_nisplus/nisplus-hosts.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2003, 2005, 2006, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2003, 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
 
@@ -38,10 +38,10 @@ static nis_name tablename_val;
 static u_long tablename_len;
 
 #define NISENTRYVAL(idx, col, res) \
-        (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
+	(NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val)
 
 #define NISENTRYLEN(idx, col, res) \
-        (NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
+	(NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
 
 /* Get implementation for some internal functions. */
 #include <resolv/mapv4v6addr.h>
@@ -287,15 +287,15 @@ internal_nisplus_gethostent_r (struct hostent *host, char *buffer,
 	      return NSS_STATUS_TRYAGAIN;
 	    }
 	  if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
-            {
-              enum nss_status retval = niserr2nss (result->status);
-              if (retval == NSS_STATUS_TRYAGAIN)
-                {
-                  *herrnop = NETDB_INTERNAL;
-                  *errnop = errno;
-                }
-              return retval;
-            }
+	    {
+	      enum nss_status retval = niserr2nss (result->status);
+	      if (retval == NSS_STATUS_TRYAGAIN)
+		{
+		  *herrnop = NETDB_INTERNAL;
+		  *errnop = errno;
+		}
+	      return retval;
+	    }
 
 	}
       else
@@ -308,18 +308,18 @@ internal_nisplus_gethostent_r (struct hostent *host, char *buffer,
 	      return NSS_STATUS_TRYAGAIN;
 	    }
 	  if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
-            {
-              enum nss_status retval= niserr2nss (result->status);
+	    {
+	      enum nss_status retval= niserr2nss (result->status);
 
 	      nis_freeresult (result);
 	      result = saved_res;
-              if (retval == NSS_STATUS_TRYAGAIN)
-                {
-                  *herrnop = NETDB_INTERNAL;
+	      if (retval == NSS_STATUS_TRYAGAIN)
+		{
+		  *herrnop = NETDB_INTERNAL;
 		  *errnop = errno;
-                }
-              return retval;
-            }
+		}
+	      return retval;
+	    }
 	}
 
       if (_res.options & RES_USE_INET6)
@@ -330,13 +330,13 @@ internal_nisplus_gethostent_r (struct hostent *host, char *buffer,
 						buflen, errnop, 0);
 
       if (parse_res == -1)
-        {
+	{
 	  nis_freeresult (result);
 	  result = saved_res;
-          *herrnop = NETDB_INTERNAL;
+	  *herrnop = NETDB_INTERNAL;
 	  *errnop = ERANGE;
-          return NSS_STATUS_TRYAGAIN;
-        }
+	  return NSS_STATUS_TRYAGAIN;
+	}
       if (saved_res != NULL)
 	nis_freeresult (saved_res);
 
@@ -435,6 +435,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
   if (result == NULL)
     {
       *errnop = ENOMEM;
+      *herrnop = NETDB_INTERNAL;
       return NSS_STATUS_TRYAGAIN;
     }
 
@@ -444,10 +445,13 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
       if (retval == NSS_STATUS_TRYAGAIN)
 	{
 	  *errnop = errno;
-	  *herrnop = NETDB_INTERNAL;
+	  *herrnop = TRY_AGAIN;
 	}
       else
-	__set_errno (olderr);
+	{
+	  __set_errno (olderr);
+	  *herrnop = NETDB_INTERNAL;
+	}
       nis_freeresult (result);
       return retval;
     }
@@ -502,7 +506,7 @@ _nss_nisplus_gethostbyname_r (const char *name, struct hostent *host,
 					  buflen, errnop, h_errnop,
 					  AI_V4MAPPED);
       if (status == NSS_STATUS_SUCCESS)
-        return status;
+	return status;
     }
 
   return internal_gethostbyname2_r (name, AF_INET, host, buffer,
diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c
index 68fb969..e5f5b48 100644
--- a/nss/nss_files/files-hosts.c
+++ b/nss/nss_files/files-hosts.c
@@ -423,6 +423,11 @@ _nss_files_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
       if (! keep_stream)
 	internal_endent ();
     }
+  else if (status == NSS_STATUS_TRYAGAIN)
+    {
+      *errnop = errno;
+      *herrnop = TRY_AGAIN;
+    }
   else
     {
       *errnop = errno;
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index a788d18..62c38f6 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -719,13 +719,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
 		      if (status != NSS_STATUS_TRYAGAIN
 			  || rc != ERANGE || herrno != NETDB_INTERNAL)
 			{
-			  if (herrno == NETDB_INTERNAL)
-			    {
-			      __set_h_errno (herrno);
-			      _res.options = old_res_options;
-			      return -EAI_SYSTEM;
-			    }
-			  if (herrno == TRY_AGAIN)
+			  if (status == NSS_STATUS_TRYAGAIN
+			      && herrno == TRY_AGAIN)
 			    no_data = EAI_AGAIN;
 			  else
 			    no_data = herrno == NO_DATA;

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                       |   31 +++++++++++
 dirent/dirent.h                 |    4 +-
 elf/dl-lookup.c                 |    7 ++-
 elf/dl-object.c                 |    8 ++-
 include/link.h                  |    8 ++-
 nis/nss_nis/nis-hosts.c         |   47 +++++++++--------
 nis/nss_nisplus/nisplus-hosts.c |   58 +++++++++++---------
 nss/nss_files/files-hosts.c     |    5 ++
 posix/regcomp.c                 |  112 ++++++++++++++++++++-------------------
 sysdeps/posix/getaddrinfo.c     |    9 +---
 10 files changed, 168 insertions(+), 121 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]