mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 12:30:06 +00:00
inet: Remove strdupa from nrl_domainname()
We can use the already in place scratch_buffer. Checked on x86_64-linux-gnu. Reviewed-by: DJ Delorie <dj@redhat.com>
This commit is contained in:
parent
c54d689269
commit
b3c68b10af
@ -118,15 +118,15 @@ nrl_domainname_core (struct scratch_buffer *tmpbuf)
|
||||
else
|
||||
{
|
||||
/* We need to preserve the hostname. */
|
||||
const char *hstname = strdupa (tmpbuf->data);
|
||||
while (__gethostbyname_r (hstname, &th,
|
||||
tmpbuf->data,
|
||||
tmpbuf->length,
|
||||
size_t hstnamelen = strlen (tmpbuf->data) + 1;
|
||||
while (__gethostbyname_r (tmpbuf->data, &th,
|
||||
tmpbuf->data + hstnamelen,
|
||||
tmpbuf->length - hstnamelen,
|
||||
&h, &herror))
|
||||
{
|
||||
if (herror == NETDB_INTERNAL && errno == ERANGE)
|
||||
{
|
||||
if (!scratch_buffer_grow (tmpbuf))
|
||||
if (!scratch_buffer_grow_preserve (tmpbuf))
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user