diff options
author | murf <murf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-08-14 13:46:58 +0000 |
---|---|---|
committer | murf <murf@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-08-14 13:46:58 +0000 |
commit | 3f5588297e2f5c95cf57452fe1e4836d781025bd (patch) | |
tree | 513959faabfb8dfc9878bcd389b51d23887a87a2 /main/channel.c | |
parent | cfe23d813baba53d9a259d4bd0ded24c28eb70c0 (diff) |
Don't ask me why, but waitfordigit will immediately return a 1 on my system, unless the outfd is initialized to -1 before calling the nandfds func
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@79378 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/channel.c')
-rw-r--r-- | main/channel.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/main/channel.c b/main/channel.c index 51b5da9b3..3ddda153c 100644 --- a/main/channel.c +++ b/main/channel.c @@ -1991,12 +1991,14 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd) if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c)) return -1; /* Wait for a digit, no more than ms milliseconds total. */ + while (ms) { struct ast_channel *rchan; - int outfd; + int outfd=-1; errno = 0; rchan = ast_waitfor_nandfds(&c, 1, &cmdfd, (cmdfd > -1) ? 1 : 0, NULL, &outfd, &ms); + if (!rchan && outfd < 0 && ms) { if (errno == 0 || errno == EINTR) continue; @@ -2004,6 +2006,7 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd) return -1; } else if (outfd > -1) { /* The FD we were watching has something waiting */ + ast_log(LOG_WARNING, "The FD we were waiting for has something waiting. Waitfordigit returning numeric 1\n"); return 1; } else if (rchan) { int res; |