From 2ba6b268759c2a9dc82bd84a89017ec3190bc2f2 Mon Sep 17 00:00:00 2001 From: GHC GitLab CI Date: Thu, 26 Nov 2020 01:06:32 +0000 Subject: OSThreads: Fix error code checking pthread_join returns its error code and apparently doesn't set errno. (cherry picked from commit c488ac737e8ca3813fe6db069cbeb7abba00cfb9) --- rts/posix/OSThreads.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c index e5cf9e6d6a..6c09f86c7f 100644 --- a/rts/posix/OSThreads.c +++ b/rts/posix/OSThreads.c @@ -380,8 +380,9 @@ interruptOSThread (OSThreadId id) void joinOSThread (OSThreadId id) { - if (pthread_join(id, NULL) != 0) { - sysErrorBelch("joinOSThread: error %d", errno); + int ret = pthread_join(id, NULL); + if (ret != 0) { + sysErrorBelch("joinOSThread: error %d", ret); } } -- cgit v1.2.1