From 01e8e5e8200b02fe0f7dad33da392b1b278f373a Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Sun, 6 Jan 2013 02:04:29 -0500 Subject: [PATCH] correctly report timeout on select timeout --- input.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/input.c b/input.c index a6e561bf8..cf4aa17f7 100644 --- a/input.c +++ b/input.c @@ -274,7 +274,9 @@ static int waitForInput(lua_State *L) { * timeout at all. */ num = select(nfds, &fds, NULL, NULL, (usecs < 0) ? NULL : &timeout); - if(num <= 0) { + if (num == 0) { + return luaL_error(L, "Waiting for input failed: timeout\n"); + } else if (num < 0) { return luaL_error(L, "Waiting for input failed: %d\n", errno); }