]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Make pthread_attr_getstack fail with EINVAL when called in "unspecified behavior... roland/pthread_attr_getstack
authorRoland McGrath <roland@hack.frob.com>
Fri, 19 Apr 2013 20:49:07 +0000 (13:49 -0700)
committerRoland McGrath <roland@hack.frob.com>
Fri, 19 Apr 2013 21:57:25 +0000 (14:57 -0700)
nptl/ChangeLog
nptl/pthread_attr_getstack.c

index d2a1e477e4e908e04d73a88e39e332ca4f6525d9..85f0c40ffc2870c681d6dd3f12092dee2356870d 100644 (file)
@@ -1,3 +1,8 @@
+2013-04-19  Roland McGrath  <roland@hack.frob.com>
+
+       * pthread_attr_getstack.c: Fail with EINVAL if the stack address has
+       not been set.
+
 2013-04-11  Andreas Schwab  <schwab@suse.de>
 
        * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
index 03907b7242bfc6459d12d863cc1cf691996b7b23..696d8c07f613c524187b8607991049d65fe803a1 100644 (file)
@@ -31,6 +31,9 @@ __pthread_attr_getstack (attr, stackaddr, stacksize)
   assert (sizeof (*attr) >= sizeof (struct pthread_attr));
   iattr = (struct pthread_attr *) attr;
 
+  if (!(iattr->flags & ATTR_FLAG_STACKADDR))
+    return EINVAL;
+
   /* Store the result.  */
   *stackaddr = (char *) iattr->stackaddr - iattr->stacksize;
   *stacksize = iattr->stacksize;