diff options
author | rpj <rpj> | 2005-05-06 07:27:10 +0000 |
---|---|---|
committer | rpj <rpj> | 2005-05-06 07:27:10 +0000 |
commit | 7523c7c4d75652f67cd31cb123e1268790394c8b (patch) | |
tree | 0920ebf089ccb971e0878542f85486171a541a8a /sem_init.c | |
parent | cf42850c77554311e62d3780f6a36cbc38e5e002 (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)); |