From 22e0c16d4c94f11cb3bc3a9bd1d57c142627efaf Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 11 Oct 2018 18:50:04 +0200 Subject: util.poll: Early return from __gc in case of no valid epoll FD This could happen if the epoll FD has already been closed or the epoll_create call failed --- util-src/poll.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'util-src') diff --git a/util-src/poll.c b/util-src/poll.c index 502c5762..293c8c2b 100644 --- a/util-src/poll.c +++ b/util-src/poll.c @@ -351,6 +351,10 @@ int Lgetfd(lua_State *L) { int Lgc(lua_State *L) { struct Lpoll_state *state = luaL_checkudata(L, 1, STATE_MT); + if(state->epoll_fd != -1) { + return 0; + } + if(close(state->epoll_fd) == 0) { state->epoll_fd = -1; } -- cgit v1.2.3