=== modified file 'termkey.c' --- termkey.c 2008-11-03 21:08:34 +0000 +++ termkey.c 2008-11-03 14:45:59 +0000 @@ -510,25 +510,17 @@ case TERMKEY_RES_AGAIN: { - if(tk->is_closed) - // We're closed now. Never going to get more bytes so just go with - // what we have - return termkey_getkey_force(tk, key); - struct pollfd fd; fd.fd = tk->fd; fd.events = POLLIN; - poll(&fd, 1, tk->waittime); - - if(fd.revents & (POLLIN|POLLHUP|POLLERR)) - ret = termkey_advisereadable(tk); - else - ret = TERMKEY_RES_NONE; - - if(ret == TERMKEY_RES_NONE) + int pollres = poll(&fd, 1, tk->waittime); + + if(pollres == 0) return termkey_getkey_force(tk, key); + + termkey_advisereadable(tk); } break; }