Cygwin: raise: align return value and error checking to Linux

raise(2) on Linux returns the same values and sets errno
independent of calling kill(2) or pthread_kill(3).  Align
code to behave the same.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2021-11-22 12:35:39 +01:00
parent 24bffff63e
commit afb7c557d2
1 changed files with 6 additions and 1 deletions

View File

@ -303,7 +303,12 @@ raise (int sig)
pthread *thread = _my_tls.tid;
if (!thread || !__isthreaded)
return kill (myself->pid, sig);
return pthread_kill (thread, sig);
/* Make sure to return -1 and set errno, as on Linux. */
int err = pthread_kill (thread, sig);
if (err)
set_errno (err);
return err ? -1 : 0;
}
static int