diff options
author | rpj <rpj> | 2005-05-06 07:31:28 +0000 |
---|---|---|
committer | rpj <rpj> | 2005-05-06 07:31:28 +0000 |
commit | 78f83cfa240ec14874b22c7302ff8d306c130aaf (patch) | |
tree | bf29a117aecb99e9ecb2d30bad398d8b20392b49 /sem_init.c | |
parent | e3845d9b6b0a18ffdfdf0cefd811a17fce62f1ac (diff) |
''
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)); |