aboutsummaryrefslogtreecommitdiffstats
path: root/util-src/poll.c
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-10-11 18:50:04 +0200
committerKim Alvefur <zash@zash.se>2018-10-11 18:50:04 +0200
commitdc9800c9296e02c5cad7eaaa76f8fc14ec3aa1f0 (patch)
treec03ee59633b6bc1bd379af20cd25d17789d393d9 /util-src/poll.c
parent71c3649d974843dfcbcfb0a9e5b72c57b37264fb (diff)
downloadprosody-dc9800c9296e02c5cad7eaaa76f8fc14ec3aa1f0.tar.gz
prosody-dc9800c9296e02c5cad7eaaa76f8fc14ec3aa1f0.zip
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
Diffstat (limited to 'util-src/poll.c')
-rw-r--r--util-src/poll.c4
1 files changed, 4 insertions, 0 deletions
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;
}