[svn-commits] dlee: branch dlee/taskprocessor-optimization r400006 - /team/dlee/taskprocess...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Fri Sep 27 14:56:07 CDT 2013
Author: dlee
Date: Fri Sep 27 14:56:05 2013
New Revision: 400006
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=400006
Log:
Review feedback:
* Catch errors trying to sem_init() with a value greater than AST_SEM_VALUE_MAX
* Use the AST_SEM_VALUE_MAX macro instead of INT_MAX in ast_sem_post()
Modified:
team/dlee/taskprocessor-optimization/main/sem.c
Modified: team/dlee/taskprocessor-optimization/main/sem.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/taskprocessor-optimization/main/sem.c?view=diff&rev=400006&r1=400005&r2=400006
==============================================================================
--- team/dlee/taskprocessor-optimization/main/sem.c (original)
+++ team/dlee/taskprocessor-optimization/main/sem.c Fri Sep 27 14:56:05 2013
@@ -40,6 +40,13 @@
return -1;
}
+ /* Since value is unsigned, this will also catch attempts to init with
+ * a negative value */
+ if (value > AST_SEM_VALUE_MAX) {
+ errno = EINVAL;
+ return -1;
+ }
+
sem->count = value;
sem->waiters = 0;
ast_mutex_init(&sem->mutex);
@@ -60,7 +67,7 @@
ast_assert(sem->count >= 0);
- if (sem->count == INT_MAX) {
+ if (sem->count == AST_SEM_VALUE_MAX) {
errno = EOVERFLOW;
return -1;
}
More information about the svn-commits
mailing list