X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fthread%2Fsem_post.c;fp=src%2Fthread%2Fsem_post.c;h=14a2dfe23ca09290db575f4c5b27e4c31e1eff24;hb=26120950e26478740a29fd0b1fd78a0bd6b880c8;hp=148ab780e8f94d04ac2a0e222ff1f8631096708a;hpb=42976cee2d31bbaade6d2169a9f234cd82af0715;p=musl diff --git a/src/thread/sem_post.c b/src/thread/sem_post.c index 148ab780..14a2dfe2 100644 --- a/src/thread/sem_post.c +++ b/src/thread/sem_post.c @@ -7,6 +7,10 @@ int sem_post(sem_t *sem) do { val = sem->__val[0]; waiters = sem->__val[1]; + if (val == SEM_VALUE_MAX) { + errno = EOVERFLOW; + return -1; + } } while (a_cas(sem->__val, val, val+1+(val<0)) != val); if (val<0 || waiters) __wake(sem->__val, 1, 0); return 0;