Module Name:    src
Committed By:   drochner
Date:           Wed Aug 15 13:28:32 UTC 2012

Modified Files:
        src/lib/libpthread: pthread.c

Log Message:
return errno if pthread_create hits the system limit, not just -1
(this is not entirely correct because it can return ENOMEM which is
not mentioned in the spec, but there are other places in pthread_create
whete ENOMEM is returned -- it at all, this should be fixed everywhere)


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/lib/libpthread/pthread.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.136 src/lib/libpthread/pthread.c:1.137
--- src/lib/libpthread/pthread.c:1.136	Thu Aug  2 12:43:41 2012
+++ src/lib/libpthread/pthread.c	Wed Aug 15 13:28:32 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.136 2012/08/02 12:43:41 joerg Exp $	*/
+/*	$NetBSD: pthread.c,v 1.137 2012/08/15 13:28:32 drochner Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread.c,v 1.136 2012/08/02 12:43:41 joerg Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.137 2012/08/15 13:28:32 drochner Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -498,6 +498,7 @@ pthread_create(pthread_t *thread, const 
 		flag |= LWP_SUSPENDED;
 	ret = _lwp_create(&newthread->pt_uc, flag, &newthread->pt_lid);
 	if (ret != 0) {
+		ret = errno;
 		pthread_mutex_lock(&newthread->pt_lock);
 		/* Will unlock and free name. */
 		pthread__reap(newthread);

Reply via email to