summaryrefslogtreecommitdiff
path: root/sysdeps/generic/ifreq.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic/ifreq.h')
-rw-r--r--sysdeps/generic/ifreq.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/sysdeps/generic/ifreq.h b/sysdeps/generic/ifreq.h
index c96d1c8789..f750065cd3 100644
--- a/sysdeps/generic/ifreq.h
+++ b/sysdeps/generic/ifreq.h
@@ -44,10 +44,10 @@ __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
}
ifc.ifc_buf = NULL;
- rq_len = RQ_IFS * sizeof (struct ifreq);
+ rq_len = RQ_IFS * sizeof (struct ifreq) / 2; /* Doubled in the loop. */
do
{
- ifc.ifc_len = rq_len;
+ ifc.ifc_len = rq_len *= 2;
ifc.ifc_buf = realloc (ifc.ifc_buf, ifc.ifc_len);
if (ifc.ifc_buf == NULL || __ioctl (fd, SIOCGIFCONF, &ifc) < 0)
{
@@ -60,7 +60,6 @@ __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
*ifreqs = NULL;
return;
}
- rq_len *= 2;
}
while (rq_len < sizeof (struct ifreq) + ifc.ifc_len);