From 56c2772487be14a1dde2d2da7929725d8035f5fb Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 12 Oct 2018 03:20:09 +0200 Subject: net.server_epoll: Graceful handling of registering already added socket --- util-src/poll.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'util-src') diff --git a/util-src/poll.c b/util-src/poll.c index 7fd28524..58f29041 100644 --- a/util-src/poll.c +++ b/util-src/poll.c @@ -452,10 +452,16 @@ int luaopen_util_poll(lua_State *L) { #endif } - lua_createtable(L, 0, 1); + lua_createtable(L, 0, 2); { lua_pushcfunction(L, Lnew); lua_setfield(L, -2, "new"); + +#define push_errno(named_error) lua_pushinteger(L, named_error);\ + lua_setfield(L, -2, #named_error); + + push_errno(EEXIST); + } return 1; } -- cgit v1.2.3