-GNU C Library NEWS -- history of user-visible changes. 2011-1-12
+GNU C Library NEWS -- history of user-visible changes. 2011-1-13
Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
See the end for copying conditions.
* The following bugs are resolved with this release:
- 3268, 7066, 10085, 10851, 11149, 11155, 11611, 11640, 11655, 11701,
+ 3268, 7066, 10085, 10484, 10851, 11149, 11155, 11611, 11640, 11655, 11701,
11840, 11856, 11883, 11903, 11904, 11968, 11979, 12005, 12037,
12067, 12077, 12078, 12092, 12093, 12107, 12108, 12113, 12140,
12159, 12167, 12191, 12194, 12201, 12204, 12205, 12207, 12348, 12394
/* Hosts file parser in nss_files module.
- Copyright (C) 1996-2001, 2003-2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1996-2001, 2003-2009, 2011 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
&& _res_hconf.flags & HCONF_FLAG_MULTI) \
{ \
/* We have to get all host entries from the file. */ \
- const size_t tmp_buflen = MIN (buflen, 4096); \
- char tmp_buffer[tmp_buflen] \
+ size_t tmp_buflen = MIN (buflen, 4096); \
+ char tmp_buffer_stack[tmp_buflen] \
__attribute__ ((__aligned__ (__alignof__ (struct hostent_data))));\
+ char *tmp_buffer = tmp_buffer_stack; \
struct hostent tmp_result_buf; \
int naddrs = 1; \
int naliases = 0; \
char *bufferend; \
+ bool tmp_buffer_malloced = false; \
\
while (result->h_aliases[naliases] != NULL) \
++naliases; \
\
bufferend = (char *) &result->h_aliases[naliases + 1]; \
\
+ again: \
while ((status = internal_getent (&tmp_result_buf, tmp_buffer, \
tmp_buflen, errnop H_ERRNO_ARG \
EXTRA_ARGS_VALUE)) \
} \
/* If the real name is different add it also to the \
aliases. This means that there is a duplication \
- in the alias list but this is really the users \
+ in the alias list but this is really the user's \
problem. */ \
if (strcmp (old_result->h_name, \
tmp_result_buf.h_name) != 0) \
*errnop = ERANGE; \
*herrnop = NETDB_INTERNAL; \
status = NSS_STATUS_TRYAGAIN; \
- break; \
+ goto out; \
} \
\
new_h_addr_list = \
} \
} \
\
- if (status != NSS_STATUS_TRYAGAIN) \
+ if (status == NSS_STATUS_TRYAGAIN) \
+ { \
+ size_t newsize = 2 * tmp_buflen; \
+ if (tmp_buffer_malloced) \
+ { \
+ char *newp = realloc (tmp_buffer, newsize); \
+ if (newp != NULL) \
+ { \
+ assert ((((uintptr_t) newp) \
+ & (__alignof__ (struct hostent_data) - 1)) \
+ == 0); \
+ tmp_buffer = newp; \
+ tmp_buflen = newsize; \
+ goto again; \
+ } \
+ } \
+ else if (!__libc_use_alloca (buflen + newsize)) \
+ { \
+ tmp_buffer = malloc (newsize); \
+ if (tmp_buffer != NULL) \
+ { \
+ assert ((((uintptr_t) tmp_buffer) \
+ & (__alignof__ (struct hostent_data) - 1)) \
+ == 0); \
+ tmp_buffer_malloced = true; \
+ tmp_buflen = newsize; \
+ goto again; \
+ } \
+ } \
+ else \
+ { \
+ tmp_buffer \
+ = extend_alloca (tmp_buffer, tmp_buflen, \
+ newsize \
+ + __alignof__ (struct hostent_data)); \
+ tmp_buffer = (char *) (((uintptr_t) tmp_buffer \
+ + __alignof__ (struct hostent_data) \
+ - 1) \
+ & ~(__alignof__ (struct hostent_data)\
+ - 1)); \
+ goto again; \
+ } \
+ } \
+ else \
status = NSS_STATUS_SUCCESS; \
+ out: \
+ if (tmp_buffer_malloced) \
+ free (tmp_buffer); \
} \
\
\