Loading...
threads/cprocs.c Libc-498 Libc-763.13
--- Libc/Libc-498/threads/cprocs.c
+++ Libc/Libc-763.13/threads/cprocs.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 1999, 2008 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -137,6 +137,7 @@
 #undef errno
 extern int errno;
 extern int *__error(void);
+extern int __pthread_canceled(int);
 
 void
 cthread_set_errno_self(error)
@@ -144,9 +145,14 @@
 {
 	int *ep = __error();
 	extern int __unix_conforming;
+	pthread_t self = NULL;
 
-	if ((__unix_conforming) && (error == EINTR) && (__pthread_canceled(0) == 0))
+	if ((__unix_conforming) && ((error & 0xff) == EINTR) && (__pthread_canceled(0) == 0)) {
+		self = pthread_self();
+		if (self != NULL)
+			self->cancel_error = error;
 		pthread_exit(PTHREAD_CANCELED);
+	}
 
         if (ep != &errno)
             *ep = error;