diff options
Diffstat (limited to 'nptl/pthread_cancel.c')
-rw-r--r-- | nptl/pthread_cancel.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c index 153cb198d8..805e74f2b1 100644 --- a/nptl/pthread_cancel.c +++ b/nptl/pthread_cancel.c @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <errno.h> #include <signal.h> #include "pthreadP.h" #include "atomic.h" @@ -27,8 +28,13 @@ pthread_cancel (th) pthread_t th; { volatile struct pthread *pd = (volatile struct pthread *) th; - int result = 0; + /* Make sure the descriptor is valid. */ + if (INVALID_TD_P (pd)) + /* Not a valid thread handle. */ + return ESRCH; + + int result = 0; while (1) { int oldval = pd->cancelhandling; |