Comparison

util-src/poll.c @ 10096:46a7792fdac5

util.poll: Add missing return statements in fallback mode These allowed modifying or deleting select() state for unregistered FDs. During normal usage this should never happen. Modifying one that isn't set might cause weirdness but deleting an already deleted FD isn't a problem.
author Kim Alvefur <zash@zash.se>
date Sun, 28 Jul 2019 16:17:23 +0200
parent 9954:36280801ddf1
child 10921:6eb5d2bb11af
comparison
equal deleted inserted replaced
10095:a3c66d0294e1 10096:46a7792fdac5
170 170
171 if(!FD_ISSET(fd, &state->all)) { 171 if(!FD_ISSET(fd, &state->all)) {
172 lua_pushnil(L); 172 lua_pushnil(L);
173 lua_pushstring(L, strerror(ENOENT)); 173 lua_pushstring(L, strerror(ENOENT));
174 lua_pushinteger(L, ENOENT); 174 lua_pushinteger(L, ENOENT);
175 return 3;
175 } 176 }
176 177
177 if(!lua_isnoneornil(L, 3)) { 178 if(!lua_isnoneornil(L, 3)) {
178 if(lua_toboolean(L, 3)) { 179 if(lua_toboolean(L, 3)) {
179 FD_SET(fd, &state->wantread); 180 FD_SET(fd, &state->wantread);
227 228
228 if(!FD_ISSET(fd, &state->all)) { 229 if(!FD_ISSET(fd, &state->all)) {
229 lua_pushnil(L); 230 lua_pushnil(L);
230 lua_pushstring(L, strerror(ENOENT)); 231 lua_pushstring(L, strerror(ENOENT));
231 lua_pushinteger(L, ENOENT); 232 lua_pushinteger(L, ENOENT);
233 return 3;
232 } 234 }
233 235
234 FD_CLR(fd, &state->wantread); 236 FD_CLR(fd, &state->wantread);
235 FD_CLR(fd, &state->wantwrite); 237 FD_CLR(fd, &state->wantwrite);
236 FD_CLR(fd, &state->readable); 238 FD_CLR(fd, &state->readable);