summaryrefslogtreecommitdiff
path: root/sem_init.c
diff options
context:
space:
mode:
authorrpj <rpj>2005-05-06 07:27:10 +0000
committerrpj <rpj>2005-05-06 07:27:10 +0000
commit7523c7c4d75652f67cd31cb123e1268790394c8b (patch)
tree0920ebf089ccb971e0878542f85486171a541a8a /sem_init.c
parentcf42850c77554311e62d3780f6a36cbc38e5e002 (diff)
''
Diffstat (limited to 'sem_init.c')
-rw-r--r--sem_init.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sem_init.c b/sem_init.c
index 3bb2a45..647ba18 100644
--- a/sem_init.c
+++ b/sem_init.c
@@ -72,7 +72,8 @@ sem_init (sem_t * sem, int pshared, unsigned int value)
* 0 successfully created semaphore,
* -1 failed, error in errno
* ERRNO
- * EINVAL 'sem' is not a valid semaphore,
+ * EINVAL 'sem' is not a valid semaphore, or
+ * 'value' >= _POSIX_SEM_VALUE_MAX
* ENOMEM out of memory,
* ENOSPC a required resource has been exhausted,
* ENOSYS semaphores are not supported,
@@ -92,6 +93,10 @@ sem_init (sem_t * sem, int pshared, unsigned int value)
*/
result = EPERM;
}
+ else if (value > (unsigned int)_POSIX_SEM_VALUE_MAX)
+ {
+ result = EINVAL;
+ }
else
{
s = (sem_t) calloc (1, sizeof (*s));