1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
2004-07-26  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/sysv/linux/ifreq.c (__ifreq): Assign pointer for
	new buffer at the right time.
	Reported by Jakub Bogusz <qboosh@pld-linux.org>.
This commit is contained in:
Ulrich Drepper
2004-07-26 15:22:56 +00:00
parent f89d689293
commit f3285f86f5
2 changed files with 8 additions and 2 deletions

View File

@ -71,7 +71,8 @@ __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
{
ifc.ifc_len = rq_len;
void *newp = realloc (ifc.ifc_buf, ifc.ifc_len);
if (newp == NULL || __ioctl (fd, SIOCGIFCONF, &ifc) < 0)
if (newp == NULL
|| (ifc.ifc_buf = newp, __ioctl (fd, SIOCGIFCONF, &ifc)) < 0)
{
free (ifc.ifc_buf);
@ -82,7 +83,6 @@ __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
*ifreqs = NULL;
return;
}
ifc.ifc_buf = newp;
if (!old_siocgifconf || ifc.ifc_len < rq_len)
break;