about summary refs log tree commit diff
path: root/nptl/sysdeps/unix/sysv/linux/pthread_kill.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/pthread_kill.c')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/pthread_kill.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/pthread_kill.c b/nptl/sysdeps/unix/sysv/linux/pthread_kill.c
index ca6dfd887a..2caa72882f 100644
--- a/nptl/sysdeps/unix/sysv/linux/pthread_kill.c
+++ b/nptl/sysdeps/unix/sysv/linux/pthread_kill.c
@@ -31,14 +31,14 @@ __pthread_kill (threadid, signo)
 {
   struct pthread *pd = (struct pthread *) threadid;
 
+  /* Make sure the descriptor is valid.  */
+  if (INVALID_TD_P (pd))
+    /* Not a valid thread handle.  */
+    return ESRCH;
+
   /* We have a special syscall to do the work.  */
   INTERNAL_SYSCALL_DECL (err);
 
-  /* The kernel returns EINVAL for PIDs <= 0.  This is not nice since
-     the user would expect ESRCH.  Correct it here.  */
-  if (pd->tid <= 0)
-    return ESRCH;
-
   int val = INTERNAL_SYSCALL (tkill, err, 2, pd->tid, signo);
 
   return (INTERNAL_SYSCALL_ERROR_P (val, err)