aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--util-src/poll.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/util-src/poll.c b/util-src/poll.c
index 6ec9ae35..d3d7640f 100644
--- a/util-src/poll.c
+++ b/util-src/poll.c
@@ -411,6 +411,12 @@ static int Lwait(lua_State *L) {
lua_Number timeout = luaL_checknumber(L, 2);
luaL_argcheck(L, timeout >= 0, 1, "positive number expected");
+ if(timeout == 0.0) {
+ lua_pushnil(L);
+ lua_pushstring(L, "timeout");
+ return 2;
+ }
+
#ifdef USE_EPOLL
ret = epoll_wait(state->epoll_fd, state->events, MAX_EVENTS, timeout * 1000);
#endif