about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-07-26 15:22:56 +0000
committerUlrich Drepper <drepper@redhat.com>2004-07-26 15:22:56 +0000
commitf3285f86f512ec05d101b4b995733180c4a71883 (patch)
tree82f2df2c96a260c05307546eeb22c82a0242f2b6
parentf89d6892939b2c81a17c881ce86eacd218f19d12 (diff)
downloadglibc-f3285f86f512ec05d101b4b995733180c4a71883.tar.gz
glibc-f3285f86f512ec05d101b4b995733180c4a71883.tar.xz
glibc-f3285f86f512ec05d101b4b995733180c4a71883.zip
Update.
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>.
-rw-r--r--ChangeLog6
-rw-r--r--sysdeps/unix/sysv/linux/ifreq.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index e0b4230a84..ddd4c44b39 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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>.
+
 2004-07-25  Ulrich Drepper  <drepper@redhat.com>
 
 	* inet/Versions [libc, GLIBC_2.3.4]: Add getipv4sourcefilter,
diff --git a/sysdeps/unix/sysv/linux/ifreq.c b/sysdeps/unix/sysv/linux/ifreq.c
index b93cd56eab..098f11750f 100644
--- a/sysdeps/unix/sysv/linux/ifreq.c
+++ b/sysdeps/unix/sysv/linux/ifreq.c
@@ -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;