From 0f8ed550277abeca2c2feff319e342377b11a741 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Tue, 11 Mar 2025 09:28:35 +0100 Subject: [PATCH] [winpr,sync] use separate variable to read --- winpr/libwinpr/synch/semaphore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/winpr/libwinpr/synch/semaphore.c b/winpr/libwinpr/synch/semaphore.c index 7dbc7e43b..98644d54c 100644 --- a/winpr/libwinpr/synch/semaphore.c +++ b/winpr/libwinpr/synch/semaphore.c @@ -53,13 +53,13 @@ static int SemaphoreGetFd(HANDLE handle) static DWORD SemaphoreCleanupHandle(HANDLE handle) { - SSIZE_T length = 0; WINPR_SEMAPHORE* sem = (WINPR_SEMAPHORE*)handle; if (!SemaphoreIsHandled(handle)) return WAIT_FAILED; - length = read(sem->pipe_fd[0], &length, 1); + uint8_t val = 0; + const SSIZE_T length = read(sem->pipe_fd[0], &val, sizeof(val)); if (length != 1) {