Software /
code /
prosody
Changeset
9476:f3935aa4cc7e
util.poll: Handle failed epoll FD creation
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 11 Oct 2018 18:52:12 +0200 |
parents | 9475:9b26a50cdfe3 |
children | 9477:0738f5276e0a |
files | util-src/poll.c |
diffstat | 1 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/util-src/poll.c Thu Oct 11 18:50:04 2018 +0200 +++ b/util-src/poll.c Thu Oct 11 18:52:12 2018 +0200 @@ -386,8 +386,19 @@ /* Initialize state */ #ifdef USE_EPOLL - state->epoll_fd = epoll_create1(0); + state->epoll_fd = -1; state->processed = 0; + + int epoll_fd = epoll_create1(EPOLL_CLOEXEC); + + if(epoll_fd <= 0) { + lua_pushnil(L); + lua_pushstring(L, strerror(errno)); + lua_pushinteger(L, errno); + return 3; + } + + state->epoll_fd = epoll_fd; #else FD_ZERO(&state->wantread); FD_ZERO(&state->wantwrite);