Index: channels/chan_dahdi.c =================================================================== --- channels/chan_dahdi.c (revision 186569) +++ channels/chan_dahdi.c (working copy) @@ -6516,7 +6516,7 @@ ast_setstate(chan, AST_STATE_RING); while (time(NULL) < start + 3) { res = ast_waitfor(chan, 1000); - if (res) { + if (res > 0) { f = ast_read(chan); if (!f) { ast_log(LOG_WARNING, "Whoa, hangup while waiting for first ring!\n"); Index: apps/app_chanspy.c =================================================================== --- apps/app_chanspy.c (revision 186569) +++ apps/app_chanspy.c (working copy) @@ -312,7 +312,7 @@ has arrived, since the spied-on channel could have gone away while we were waiting */ - while ((res = ast_waitfor(chan, -1) > -1) && csth.spy_audiohook.status == AST_AUDIOHOOK_STATUS_RUNNING) { + while ((res = ast_waitfor(chan, -1) > 0) && csth.spy_audiohook.status == AST_AUDIOHOOK_STATUS_RUNNING) { if (!(f = ast_read(chan)) || ast_check_hangup(chan)) { running = -1; break; Index: apps/app_dictate.c =================================================================== --- apps/app_dictate.c (revision 186569) +++ apps/app_dictate.c (working copy) @@ -160,7 +160,7 @@ res = 0; lastop = 0; samples = 0; - while (!done && ((res = ast_waitfor(chan, -1)) > -1) && fs && (f = ast_read(chan))) { + while (!done && ((res = ast_waitfor(chan, -1)) > 0) && fs && (f = ast_read(chan))) { if (digit) { struct ast_frame fr = {AST_FRAME_DTMF, digit}; ast_queue_frame(chan, &fr); Index: apps/app_dahdiscan.c =================================================================== --- apps/app_dahdiscan.c (revision 186569) +++ apps/app_dahdiscan.c (working copy) @@ -296,6 +296,7 @@ struct ast_frame *f; char *desired_group; int input=0,search_group=0; + int waitfor_res = 0; u = ast_module_user_add(chan); @@ -309,8 +310,13 @@ } for (;;) { - if (ast_waitfor(chan, 100) < 0) + if ((waitfor_res = ast_waitfor(chan, 100) < 0)) { break; + } + + if (waitfor_res == 0) { + continue; + } f = ast_read(chan); if (!f) Index: apps/app_alarmreceiver.c =================================================================== --- apps/app_alarmreceiver.c (revision 186569) +++ apps/app_alarmreceiver.c (working copy) @@ -182,7 +182,7 @@ for(;;) { - if (ast_waitfor(chan, -1) < 0){ + if (ast_waitfor(chan, -1) == 0){ res = -1; break; } @@ -257,7 +257,7 @@ break; } - if ((r = ast_waitfor(chan, -1) < 0)) { + if ((r = ast_waitfor(chan, -1) == 0)) { ast_log(LOG_DEBUG, "Waitfor returned %d\n", r); continue; } Index: apps/app_meetme.c =================================================================== --- apps/app_meetme.c (revision 186569) +++ apps/app_meetme.c (working copy) @@ -1234,7 +1234,7 @@ /* when no frames are available, this will wait for 1 millisecond maximum */ - while (ast_waitfor(chan, 1)) { + while (ast_waitfor(chan, 1) > 0) { f = ast_read(chan); if (f) ast_frfree(f); @@ -3162,7 +3162,7 @@ cnf->recording = MEETME_RECORD_ACTIVE; - while (ast_waitfor(cnf->lchan, -1) > -1) { + while (ast_waitfor(cnf->lchan, -1) > 0) { if (cnf->recording == MEETME_RECORD_TERMINATE) { AST_LIST_LOCK(&confs); AST_LIST_UNLOCK(&confs); Index: apps/app_ices.c =================================================================== --- apps/app_ices.c (revision 186569) +++ apps/app_ices.c (working copy) @@ -196,7 +196,7 @@ for (;;) { /* Wait for audio, and stream */ ms = ast_waitfor(chan, -1); - if (ms < 0) { + if (ms < 1) { ast_log(LOG_DEBUG, "Hangup detected\n"); res = -1; break; Index: apps/app_disa.c =================================================================== --- apps/app_disa.c (revision 186569) +++ apps/app_disa.c (working copy) @@ -201,7 +201,7 @@ ((k&1) ? "extension" : "password"),chan->name); break; } - if ((res = ast_waitfor(chan, -1) < 0)) { + if ((res = ast_waitfor(chan, -1) == 0)) { ast_log(LOG_DEBUG, "Waitfor returned %d\n", res); continue; } Index: apps/app_url.c =================================================================== --- apps/app_url.c (revision 186569) +++ apps/app_url.c (working copy) @@ -116,7 +116,7 @@ for(;;) { /* Wait for an event */ res = ast_waitfor(chan, -1); - if (res < 0) + if (res == 0) break; f = ast_read(chan); if (!f) { Index: main/channel.c =================================================================== --- main/channel.c (revision 186569) +++ main/channel.c (working copy) @@ -4525,7 +4525,7 @@ return res; /* Give us some wiggle room */ - while (chan->generatordata && ast_waitfor(chan, 100) >= 0) { + while (chan->generatordata && ast_waitfor(chan, 100) > 0) { struct ast_frame *f = ast_read(chan); if (f) ast_frfree(f); Index: main/pbx.c =================================================================== --- main/pbx.c (revision 186569) +++ main/pbx.c (working copy) @@ -5378,7 +5378,7 @@ ast_safe_sleep(chan, waittime * 1000); } else do { res = ast_waitfor(chan, -1); - if (res < 0) + if (res == 0) return; f = ast_read(chan); if (f) Index: res/res_agi.c =================================================================== --- res/res_agi.c (revision 186569) +++ res/res_agi.c (working copy) @@ -1004,6 +1004,9 @@ ast_dsp_free(sildet); return RESULT_FAILURE; } + if (res == 0) { + continue; + } f = ast_read(chan); if (!f) { fdprintf(agi->fd, "200 result=%d (hangup) endpos=%ld\n", -1, sample_offset);