diff options
Diffstat (limited to 'sem_init.c')
-rw-r--r-- | sem_init.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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)); |