(pthread_getattr_np): Avoid stacksize value > than stackaddr.
authordrepper <drepper>
Wed, 17 Sep 2003 10:22:33 +0000 (10:22 +0000)
committerdrepper <drepper>
Wed, 17 Sep 2003 10:22:33 +0000 (10:22 +0000)
linuxthreads/attr.c

index f88203f..687334f 100644 (file)
@@ -452,6 +452,11 @@ int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr)
                  attr->__stacksize = rl.rlim_cur;
                  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;
+
                  /* We succeed and no need to look further.  */
                  ret = 0;
                  break;