summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/sem_new.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2015-02-08 21:58:25 +0000
committerjilles <jilles@FreeBSD.org>2015-02-08 21:58:25 +0000
commitcd2062bcd847783bfbf08b368c64a28eb7785d05 (patch)
tree07d913949803c0991b4fc315c8b006f717b116b8 /lib/libc/gen/sem_new.c
parentff1f47aebc5a88be518bca28fd1e1b2f6545af58 (diff)
downloadFreeBSD-src-cd2062bcd847783bfbf08b368c64a28eb7785d05.zip
FreeBSD-src-cd2062bcd847783bfbf08b368c64a28eb7785d05.tar.gz
MFC r277862: sem_post(): Fix and document semaphore value overflow error.
The error code is per Austin Group issue #315. I provided different wording for the manual page change. Submitted by: pluknet
Diffstat (limited to 'lib/libc/gen/sem_new.c')
-rw-r--r--lib/libc/gen/sem_new.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/gen/sem_new.c b/lib/libc/gen/sem_new.c
index ec1a2fd..7b04ef0 100644
--- a/lib/libc/gen/sem_new.c
+++ b/lib/libc/gen/sem_new.c
@@ -439,8 +439,10 @@ _sem_post(sem_t *sem)
do {
count = sem->_kern._count;
- if (count + 1 > SEM_VALUE_MAX)
- return (EOVERFLOW);
+ if (count + 1 > SEM_VALUE_MAX) {
+ errno = EOVERFLOW;
+ return (-1);
+ }
} while(!atomic_cmpset_rel_int(&sem->_kern._count, count, count+1));
(void)usem_wake(&sem->_kern);
return (0);
OpenPOWER on IntegriCloud