From: Rich Felker Date: Fri, 4 May 2018 17:18:51 +0000 (-0400) Subject: remove incorrect ESRCH error from pthread_kill X-Git-Tag: v1.1.20~94 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4df42163511182bfd6fc55e85250b93786dcce7e;p=oweals%2Fmusl.git remove incorrect ESRCH error from pthread_kill posix documents in the rationale and future directions for pthread_kill that, since the lifetime of the thread id for a joinable thread lasts until it is joined, ESRCH is not a correct error for pthread_kill to produce when the target thread has exited but not yet been joined, and that conforming applications cannot attempt to detect this state. future versions of the standard may explicitly require that ESRCH not be returned for this case. --- diff --git a/src/thread/pthread_kill.c b/src/thread/pthread_kill.c index f0903420..0a139231 100644 --- a/src/thread/pthread_kill.c +++ b/src/thread/pthread_kill.c @@ -4,7 +4,8 @@ int pthread_kill(pthread_t t, int sig) { int r; LOCK(t->killlock); - r = t->dead ? ESRCH : -__syscall(SYS_tkill, t->tid, sig); + r = t->dead ? (sig+0U >= _NSIG ? EINVAL : 0) + : -__syscall(SYS_tkill, t->tid, sig); UNLOCK(t->killlock); return r; }