diff options
Diffstat (limited to 'nptl')
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/pthread_kill.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/pthread_kill.c b/nptl/sysdeps/unix/sysv/linux/pthread_kill.c index 0fce02a..e1c79e7 100644 --- a/nptl/sysdeps/unix/sysv/linux/pthread_kill.c +++ b/nptl/sysdeps/unix/sysv/linux/pthread_kill.c @@ -34,7 +34,11 @@ __pthread_kill (threadid, signo) /* We have a special syscall to do the work. */ INTERNAL_SYSCALL_DECL (err); - int val = INTERNAL_SYSCALL (tkill, err, 2, pd->tid, signo); + /* The kernel returns EINVAL for PIDs <= 0. This is not nice since + the user would expect ESRCH. Correct it here. */ + int val = (pd->tid > 0 + ? INTERNAL_SYSCALL (tkill, err, 2, pd->tid, signo) + : ESRCH); return (INTERNAL_SYSCALL_ERROR_P (val, err) ? INTERNAL_SYSCALL_ERRNO (val, err) : 0); |