Software /
code /
prosody
Changeset
6875:12d68f7b1be0
mod_posix: Detect failure to load util.signal by first pcall return value not by type of the second
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 26 Sep 2015 21:41:11 +0200 |
parents | 6874:e011f289ec77 |
children | 6876:d1fc95d22f33 |
files | plugins/mod_posix.lua |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_posix.lua Sat Sep 26 21:39:26 2015 +0200 +++ b/plugins/mod_posix.lua Sat Sep 26 21:41:11 2015 +0200 @@ -14,8 +14,8 @@ module:log("warn", "Unknown version (%s) of binary pposix module, expected %s. Perhaps you need to recompile?", tostring(pposix._VERSION), want_pposix_version); end -local signal = select(2, pcall(require, "util.signal")); -if type(signal) == "string" then +local have_signal, signal = pcall(require, "util.signal"); +if not have_signal then module:log("warn", "Couldn't load signal library, won't respond to SIGTERM"); end @@ -162,7 +162,7 @@ module:hook("server-stopped", remove_pidfile); -- Set signal handlers -if signal.signal then +if have_signal then signal.signal("SIGTERM", function () module:log("warn", "Received SIGTERM"); prosody.unlock_globals();