summaryrefslogtreecommitdiff
path: root/addons/ooh323cDriver.c
diff options
context:
space:
mode:
authorAlexandr Anikin <may@telecom-service.ru>2012-07-04 18:46:56 +0000
committerAlexandr Anikin <may@telecom-service.ru>2012-07-04 18:46:56 +0000
commit324e47342e9e54238ed6a7474b899ab87b3fd821 (patch)
tree5a5bf8f28abb6b9676a2feb8bdee12185ca784f0 /addons/ooh323cDriver.c
parent474b023ad434b2a77373435f35a7e36cf6ffcfa8 (diff)
Fix modern gcc warning
Review: https://reviewboard.asterisk.org/r/1767 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369602 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'addons/ooh323cDriver.c')
-rw-r--r--addons/ooh323cDriver.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/addons/ooh323cDriver.c b/addons/ooh323cDriver.c
index 1672849ca..e2533fa6e 100644
--- a/addons/ooh323cDriver.c
+++ b/addons/ooh323cDriver.c
@@ -82,7 +82,7 @@ void* ooh323c_call_thread(void* dummy)
struct callthread* mycthread = (struct callthread *)dummy;
struct pollfd pfds[1];
char c;
- int res;
+ int res = 0;
do {
@@ -114,7 +114,7 @@ void* ooh323c_call_thread(void* dummy)
ast_mutex_unlock(&mycthread->lock);
ast_mutex_unlock(&callThreadsLock);
- } while (mycthread->call != NULL);
+ } while (mycthread->call != NULL && res == 0);
ast_mutex_destroy(&mycthread->lock);
@@ -129,7 +129,6 @@ void* ooh323c_call_thread(void* dummy)
int ooh323c_start_call_thread(ooCallData *call) {
char c = 'c';
- int res;
struct callthread *cur = callThreads;
ast_mutex_lock(&callThreadsLock);
@@ -138,9 +137,11 @@ int ooh323c_start_call_thread(ooCallData *call) {
}
ast_mutex_unlock(&callThreadsLock);
- if (cur != NULL && cur->inUse) {
+ if (cur != NULL) {
+ if (cur->inUse || write(cur->thePipe[1], &c, 1) < 0) {
ast_mutex_unlock(&cur->lock);
cur = NULL;
+ }
}
/* make new thread */
@@ -181,7 +182,6 @@ int ooh323c_start_call_thread(ooCallData *call) {
ast_debug(1,"using existing call thread for call %s\n", call->callToken);
cur->inUse = TRUE;
cur->call = call;
- res = write(cur->thePipe[1], &c, 1);
ast_mutex_unlock(&cur->lock);
}