diff options
author | Kim Alvefur <zash@zash.se> | 2015-09-26 21:41:11 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2015-09-26 21:41:11 +0200 |
commit | c04b24d70bcd1b218f9a0b1556d292a51c121a4a (patch) | |
tree | 807b3af57cd7b71ca01cbd80fe112e1dadb4199a /plugins/mod_posix.lua | |
parent | af84a2e79ba6c5ea22fd79e6f23a85ac3bd5cfeb (diff) | |
download | prosody-c04b24d70bcd1b218f9a0b1556d292a51c121a4a.tar.gz prosody-c04b24d70bcd1b218f9a0b1556d292a51c121a4a.zip |
mod_posix: Detect failure to load util.signal by first pcall return value not by type of the second
Diffstat (limited to 'plugins/mod_posix.lua')
-rw-r--r-- | plugins/mod_posix.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/mod_posix.lua b/plugins/mod_posix.lua index e9e43fa0..7e6d8799 100644 --- a/plugins/mod_posix.lua +++ b/plugins/mod_posix.lua @@ -14,8 +14,8 @@ if pposix._VERSION ~= want_pposix_version then 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 @@ end 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(); |