Application-specified thread stacks didn't work with libpthread
authorguenther <guenther@openbsd.org>
Mon, 7 Jul 2008 04:59:22 +0000 (04:59 +0000)
committerguenther <guenther@openbsd.org>
Mon, 7 Jul 2008 04:59:22 +0000 (04:59 +0000)
because it treated the supplied memory as holding an internal data
structure instead of as the stack space itself

ok kurt@, "looks ok" otto@, tested on hppa by kettenis@

lib/libpthread/uthread/uthread_create.c

index adeada4..3a5f7a6 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uthread_create.c,v 1.21 2005/01/23 19:23:47 kettenis Exp $    */
+/*     $OpenBSD: uthread_create.c,v 1.22 2008/07/07 04:59:22 guenther Exp $    */
 /*
  * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
  * All rights reserved.
@@ -84,17 +84,13 @@ pthread_create(pthread_t *thread, const pthread_attr_t *attr,
                } else {
                        pattr = *attr;
                }
-               /* Check if a stack was specified in the thread attributes: */
-               if ((stack = pattr->stackaddr_attr) != NULL) {
-               }
+
                /* Allocate a stack: */
-               else {
-                       stack = _thread_stack_alloc(pattr->stackaddr_attr,
-                           pattr->stacksize_attr);
-                       if (stack == NULL) {
-                               ret = EAGAIN;
-                               free(new_thread);
-                       }
+               stack = _thread_stack_alloc(pattr->stackaddr_attr,
+                   pattr->stacksize_attr);
+               if (stack == NULL) {
+                       ret = EAGAIN;
+                       free(new_thread);
                }
 
                /* Check for errors: */