Software /
code /
prosody
Comparison
util-src/signal.c @ 8420:fb27aff6d491
util.signal: Fix loop (fixes #1047)
A pre-commit version probably started with i = nsig and counted down,
then an incomplete change to counting up was done
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 30 Nov 2017 19:35:35 +0100 |
parent | 8414:7ea3311ca632 |
child | 9150:c1d5f52274cf |
comparison
equal
deleted
inserted
replaced
8419:57610304e30d | 8420:fb27aff6d491 |
---|---|
170 lua_sethook(L, Hsig, Hmask, Hcount); | 170 lua_sethook(L, Hsig, Hmask, Hcount); |
171 | 171 |
172 lua_pushstring(L, LUA_SIGNAL); | 172 lua_pushstring(L, LUA_SIGNAL); |
173 lua_gettable(L, LUA_REGISTRYINDEX); | 173 lua_gettable(L, LUA_REGISTRYINDEX); |
174 | 174 |
175 for(int i = 1; i <= nsig; i--) { | 175 for(int i = 0; i < nsig; i++) { |
176 lua_pushnumber(L, signals[i]); | 176 lua_pushnumber(L, signals[i]); |
177 lua_gettable(L, -2); | 177 lua_gettable(L, -2); |
178 lua_call(L, 0, 0); | 178 lua_call(L, 0, 0); |
179 }; | 179 }; |
180 | 180 |
194 /* Set our new debug hook */ | 194 /* Set our new debug hook */ |
195 lua_sethook(Lsig, sighook, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); | 195 lua_sethook(Lsig, sighook, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); |
196 } | 196 } |
197 | 197 |
198 if(nsig < MAX_PENDING_SIGNALS) { | 198 if(nsig < MAX_PENDING_SIGNALS) { |
199 signals[++nsig] = sig; | 199 signals[nsig++] = sig; |
200 } | 200 } |
201 } | 201 } |
202 | 202 |
203 /* | 203 /* |
204 * l_signal == signal(signal [, func [, chook]]) | 204 * l_signal == signal(signal [, func [, chook]]) |