about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2011-12-14 13:14:56 -0800
committerRoland McGrath <roland@hack.frob.com>2011-12-14 13:14:56 -0800
commite988dba98d852d08707d00eec0072548fdf2eb24 (patch)
treecfb296bdd96c310f17cafe3d73a09026a081da2e
parent26428b7c692af44c61150677b6798294ccd397a0 (diff)
downloadglibc-e988dba98d852d08707d00eec0072548fdf2eb24.tar.gz
glibc-e988dba98d852d08707d00eec0072548fdf2eb24.tar.xz
glibc-e988dba98d852d08707d00eec0072548fdf2eb24.zip
BZ #5245: pthread_create returns EAGAIN for stack allocation failure, not ENOMEM.
-rw-r--r--nptl/ChangeLog5
-rw-r--r--nptl/pthread_create.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 448aa9357f..bdf61296e2 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-14  Jeff Law  <law@redhat.com>
+
+	[BZ #5245]
+	* pthread_create.c (__pthread_create_2_1): Translate ENOMEM to EAGAIN.
+
 2011-11-28  Andreas Schwab  <schwab@redhat.com>
 
 	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Handle
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index f1113fb9b4..6250d03ff6 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -457,8 +457,9 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
   int err = ALLOCATE_STACK (iattr, &pd);
   if (__builtin_expect (err != 0, 0))
     /* Something went wrong.  Maybe a parameter of the attributes is
-       invalid or we could not allocate memory.  */
-    return err;
+       invalid or we could not allocate memory.  Note we have to
+       translate error codes.  */
+    return err == ENOMEM ? EAGAIN : err;
 
 
   /* Initialize the TCB.  All initializations with zero should be