Diff

util-src/poll.c @ 9475:9b26a50cdfe3

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
author Kim Alvefur <zash@zash.se>
date Thu, 11 Oct 2018 18:50:04 +0200
parent 9450:b890ceb1c24f
child 9476:f3935aa4cc7e
line wrap: on
line diff
--- a/util-src/poll.c	Thu Oct 11 17:01:45 2018 +0200
+++ b/util-src/poll.c	Thu Oct 11 18:50:04 2018 +0200
@@ -351,6 +351,10 @@
 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;
 	}