about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-03-02 10:32:19 +0000
committerUlrich Drepper <drepper@redhat.com>2002-03-02 10:32:19 +0000
commit0e25633a77e781524aa3dc50a19cf790d144f85b (patch)
tree35306eef8f6296f415c46057ea2a12f3f468afc5
parentcc8594b155fd9f75bb4192df2eee021bda0a7d72 (diff)
downloadglibc-0e25633a77e781524aa3dc50a19cf790d144f85b.tar.gz
glibc-0e25633a77e781524aa3dc50a19cf790d144f85b.tar.xz
glibc-0e25633a77e781524aa3dc50a19cf790d144f85b.zip
Update.
	* sysdeps/generic/dl-sysdep.c (_dl_important_hwcaps): Fix creation
	of .str elements in the returned data structure.
-rw-r--r--ChangeLog3
-rw-r--r--sysdeps/generic/dl-sysdep.c8
2 files changed, 7 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 6f7b8c65de..68dc1b590a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2002-03-02  Ulrich Drepper  <drepper@redhat.com>
 
+	* sysdeps/generic/dl-sysdep.c (_dl_important_hwcaps): Fix creation
+	of .str elements in the returned data structure.
+
 	* elf/elf.h: Add Alpha TLS bits.
 
 2002-02-28  Jakub Jelinek  <jakub@redhat.com>
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c
index 1975fe8a66..45980ee974 100644
--- a/sysdeps/generic/dl-sysdep.c
+++ b/sysdeps/generic/dl-sysdep.c
@@ -325,15 +325,16 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
       temp[m].len = platform_len;
       ++m;
     }
+  assert (m == cnt);
 
   /* Determine the total size of all strings together.  */
   if (cnt == 1)
     total = temp[0].len;
   else
     {
-      total = (1 << (cnt - 2)) * (temp[0].len + temp[cnt - 1].len + 2);
+      total = (1UL << (cnt - 2)) * (temp[0].len + temp[cnt - 1].len + 2);
       for (n = 1; n + 1 < cnt; ++n)
-	total += (1 << (cnt - 3)) * (temp[n].len + 1);
+	total += (1UL << (cnt - 3)) * (temp[n].len + 1);
     }
 
   /* The result structure: we use a very compressed way to store the
@@ -415,12 +416,11 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
   rp = &result[2];
   while (n != (1UL << (cnt - 1)))
     {
-      if ((n & 1) != 0)
+      if ((--n & 1) != 0)
 	rp[0].str = rp[-2].str + rp[-2].len;
       else
 	rp[0].str = rp[-1].str;
       ++rp;
-      --n;
     }
 
   /* The second have starts right after the first part of the string of