summaryrefslogtreecommitdiff
path: root/sem_init.c
diff options
context:
space:
mode:
authorrpj <rpj>2005-05-06 07:31:28 +0000
committerrpj <rpj>2005-05-06 07:31:28 +0000
commit78f83cfa240ec14874b22c7302ff8d306c130aaf (patch)
treebf29a117aecb99e9ecb2d30bad398d8b20392b49 /sem_init.c
parente3845d9b6b0a18ffdfdf0cefd811a17fce62f1ac (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));