libroot: Fix shared unnamed semaphore acquisition with timeouts.

We set flags above the timeout check, so we need to use |= and
not lose the SHARED flag we already set.

Fixes some testcases in the POSIX testsuite, and the shared
semaphore code in Gecko/Firefox.
This commit is contained in:
Augustin Cavalier
2024-09-16 15:38:29 -04:00
parent 2eb83002c5
commit d29c0e6ee5
+2 -2
View File
@@ -176,10 +176,10 @@ unnamed_sem_timedwait(sem_t* semaphore, clockid_t clock_id,
timeoutMicros = -1; timeoutMicros = -1;
switch (clock_id) { switch (clock_id) {
case CLOCK_REALTIME: case CLOCK_REALTIME:
flags = B_ABSOLUTE_REAL_TIME_TIMEOUT; flags |= B_ABSOLUTE_REAL_TIME_TIMEOUT;
break; break;
case CLOCK_MONOTONIC: case CLOCK_MONOTONIC:
flags = B_ABSOLUTE_TIMEOUT; flags |= B_ABSOLUTE_TIMEOUT;
break; break;
default: default:
return EINVAL; return EINVAL;