aboutsummaryrefslogtreecommitdiff
path: root/nptl/pthread_detach.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-02-21 10:00:33 +0000
committerUlrich Drepper <drepper@redhat.com>2003-02-21 10:00:33 +0000
commit8c2e9a29b1fbda33e57b2d33c7bfcb0de666b1fb (patch)
treeaa445512e4f44e9d00ee5624417f7ee5417c4b75 /nptl/pthread_detach.c
parent8b1a8bb409508906737ec41ed79bb88398cb5dba (diff)
downloadglibc-8c2e9a29b1fbda33e57b2d33c7bfcb0de666b1fb.tar
glibc-8c2e9a29b1fbda33e57b2d33c7bfcb0de666b1fb.tar.gz
glibc-8c2e9a29b1fbda33e57b2d33c7bfcb0de666b1fb.tar.bz2
glibc-8c2e9a29b1fbda33e57b2d33c7bfcb0de666b1fb.zip
Update.
* pthreadP.h: Define INVALID_TD_P and INVALID_NOT_TERMINATED_TD_P. * pthread_cancel.c: Use INVALID_TD_P. * pthread_detach.c: Likewise. * pthread_getschedparam.c: Likewise. * pthread_setschedparam.c: Likewise. * sysdeps/pthread/pthread_getcpuclockid.c: Likewise. * sysdeps/unix/sysv/linux/pthread_kill.c: Likewise. * pthread_join.c: Use INVALID_NOT_TERMINATED_TD_P. * pthread_timedjoin.c: Likewise. * tst-basic7.c: Include <signal.h>.
Diffstat (limited to 'nptl/pthread_detach.c')
-rw-r--r--nptl/pthread_detach.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/nptl/pthread_detach.c b/nptl/pthread_detach.c
index 2ba9f4913d..ff58e3bde5 100644
--- a/nptl/pthread_detach.c
+++ b/nptl/pthread_detach.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -27,6 +27,12 @@ pthread_detach (th)
pthread_t th;
{
struct pthread *pd = (struct pthread *) th;
+
+ /* Make sure the descriptor is valid. */
+ if (INVALID_TD_P (pd))
+ /* Not a valid thread handle. */
+ return ESRCH;
+
int result = 0;
/* Mark the thread as detached. */