From 40ddb734ee23a9a702dac99ef4ad23691452cda4 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Mon, 31 May 2021 23:11:15 +0200 Subject: [PATCH] LibPthread: Correct error check in `sem_post` and `sem_wait` --- Userland/Libraries/LibPthread/semaphore.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibPthread/semaphore.cpp b/Userland/Libraries/LibPthread/semaphore.cpp index 3b4eb73ba4..3983e6da4b 100644 --- a/Userland/Libraries/LibPthread/semaphore.cpp +++ b/Userland/Libraries/LibPthread/semaphore.cpp @@ -111,7 +111,7 @@ int sem_post(sem_t* sem) } rc = pthread_mutex_unlock(&sem->mtx); - if (errno != 0) { + if (rc != 0) { errno = rc; return -1; } @@ -153,7 +153,7 @@ int sem_unlink(const char*) int sem_wait(sem_t* sem) { auto rc = pthread_mutex_lock(&sem->mtx); - if (errno != 0) { + if (rc != 0) { errno = rc; return -1; }