diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2021-11-22 12:35:39 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2021-11-22 12:37:12 +0100 |
commit | afb7c557d2af10cdcb16c7edcc9d16224995b9e0 (patch) | |
tree | 6de80f799c79685fa8b8a56680a079a6dd0e5913 /winsup | |
parent | 24bffff63eb798d721b75b1c38c18f1687d33a2a (diff) | |
download | newlib-afb7c557d2af10cdcb16c7edcc9d16224995b9e0.zip newlib-afb7c557d2af10cdcb16c7edcc9d16224995b9e0.tar.gz newlib-afb7c557d2af10cdcb16c7edcc9d16224995b9e0.tar.bz2 |
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>
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/signal.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index f4b4686..2cf750f 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -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 |