mod_posix: Lock pidfile when in use, shut down if we can't write or lock the pidfile
[prosody.git] / util-src / signal.c
index 68ef73de365abf8d342a2a527e68895302a262bc..53bbc4ed4cb882d1174b26d33d3c8b0d4c912968 100644 (file)
@@ -165,6 +165,9 @@ static struct signal_event *last_event = NULL;
 
 static void sighook(lua_State *L, lua_Debug *ar)
 {
+  /* restore the old hook */
+  lua_sethook(L, Hsig, Hmask, Hcount);
+
   lua_pushstring(L, LUA_SIGNAL);
   lua_gettable(L, LUA_REGISTRYINDEX);
 
@@ -180,8 +183,6 @@ static void sighook(lua_State *L, lua_Debug *ar)
 
   lua_pop(L, 1); /* pop lua_signal table */
 
-  /* restore the old hook */
-  lua_sethook(L, Hsig, Hmask, Hcount);
 }
 
 static void handle(int sig)