about summary refs log tree commit diff
path: root/linuxthreads
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-12-31 22:46:53 +0000
committerUlrich Drepper <drepper@redhat.com>2003-12-31 22:46:53 +0000
commita31f867a42e8dd7a92e58f70b73366e0a3677f57 (patch)
tree3d121d1903b77603a770852988ad4c3e734f8699 /linuxthreads
parent520ec963af2e012caa5609ad2fac041f6e7af6d7 (diff)
downloadglibc-a31f867a42e8dd7a92e58f70b73366e0a3677f57.tar.gz
glibc-a31f867a42e8dd7a92e58f70b73366e0a3677f57.tar.xz
glibc-a31f867a42e8dd7a92e58f70b73366e0a3677f57.zip
Update.
	* locale/setlocale.c (setlocale): Avoid duplicating locale names
	if we can reuse old strings.
Diffstat (limited to 'linuxthreads')
-rw-r--r--linuxthreads/ChangeLog6
-rw-r--r--linuxthreads/attr.c15
2 files changed, 15 insertions, 6 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index f0f299ac1d..147811f141 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,9 @@
+2003-12-31  Ulrich Drepper  <drepper@redhat.com>
+
+	* attr.c (pthread_getattr_np): Make sure stack info returned for
+	main thread does not overlap with any other VMA.
+	Patch by Jakub Jelinek.
+
 2003-12-29  Jakub Jelinek  <jakub@redhat.com>
 
 	* sysdeps/ia64/tls.h: Include dl-sysdep.h.
diff --git a/linuxthreads/attr.c b/linuxthreads/attr.c
index 80f5249d36..a88fdb96c5 100644
--- a/linuxthreads/attr.c
+++ b/linuxthreads/attr.c
@@ -441,6 +441,7 @@ int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr)
 
 	  char *line = NULL;
 	  size_t linelen = 0;
+	  uintptr_t last_to = 0;
 
 	  while (! feof_unlocked (fp))
 	    {
@@ -449,8 +450,9 @@ int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr)
 
 	      uintptr_t from;
 	      uintptr_t to;
-	      if (sscanf (line, "%" SCNxPTR "-%" SCNxPTR, &from, &to) == 2
-		  && from <= (uintptr_t) __libc_stack_end
+	      if (sscanf (line, "%" SCNxPTR "-%" SCNxPTR, &from, &to) != 2)
+		continue;
+	      if (from <= (uintptr_t) __libc_stack_end
 		  && (uintptr_t) __libc_stack_end < to)
 		{
 		  /* Found the entry.  Now we have the info we need.  */
@@ -461,16 +463,17 @@ int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr)
 #else
 		  attr->__stackaddr = (void *) to;
 
-		  /* The limit might be too high.  This is a bogus
-		     situation but try to avoid making it worse.  */
-		  if ((size_t) attr->__stacksize > (size_t) attr->__stackaddr)
-		    attr->__stacksize = (size_t) attr->__stackaddr;
+		  /* The limit might be too high.  */
+		  if ((size_t) attr->__stacksize
+		      > (size_t) attr->__stackaddr - last_to)
+		    attr->__stacksize = (size_t) attr->__stackaddr - last_to;
 #endif
 
 		  /* We succeed and no need to look further.  */
 		  ret = 0;
 		  break;
 		}
+	      last_to = to;
 	    }
 
 	  fclose (fp);