aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_posix.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-04-22 21:32:23 +0100
committerMatthew Wild <mwild1@gmail.com>2009-04-22 21:32:23 +0100
commitca9a9eb85ebb918983c845813c22c0e6d2464aa6 (patch)
tree680b1c655c3a4b97e14f5dd996a303ff28e122cd /plugins/mod_posix.lua
parenta54da72215f3216f3ae28846604bba20e483b831 (diff)
downloadprosody-ca9a9eb85ebb918983c845813c22c0e6d2464aa6.tar.gz
prosody-ca9a9eb85ebb918983c845813c22c0e6d2464aa6.zip
mod_*: Fix a load of global accesses
Diffstat (limited to 'plugins/mod_posix.lua')
-rw-r--r--plugins/mod_posix.lua24
1 files changed, 12 insertions, 12 deletions
diff --git a/plugins/mod_posix.lua b/plugins/mod_posix.lua
index f8fda7cd..87113aac 100644
--- a/plugins/mod_posix.lua
+++ b/plugins/mod_posix.lua
@@ -6,7 +6,7 @@ if pposix._VERSION ~= want_pposix_version then module:log("warn", "Unknown versi
local signal = select(2, pcall(require, "util.signal"));
if type(signal) == "string" then
- log("warn", "Couldn't load signal library, won't respond to SIGTERM");
+ module:log("warn", "Couldn't load signal library, won't respond to SIGTERM");
end
local config_get = require "core.configmanager".get;
@@ -18,7 +18,7 @@ local pidfile_written;
local function remove_pidfile()
if pidfile_written then
- os.remove(pidfile);
+ os.remove(pidfile_written);
pidfile_written = nil;
end
end
@@ -27,11 +27,11 @@ local function write_pidfile()
if pidfile_written then
remove_pidfile();
end
- local pidfile = config.get("*", "core", "pidfile");
+ local pidfile = config_get("*", "core", "pidfile");
if pidfile then
local pf, err = io.open(pidfile, "w+");
if not pf then
- log("error", "Couldn't write pidfile; %s", err);
+ module:log("error", "Couldn't write pidfile; %s", err);
else
pf:write(tostring(pposix.getpid()));
pf:close();
@@ -62,11 +62,11 @@ if not config_get("*", "core", "no_daemonize") then
local function daemonize_server()
local ok, ret = pposix.daemonize();
if not ok then
- log("error", "Failed to daemonize: %s", ret);
+ module:log("error", "Failed to daemonize: %s", ret);
elseif ret and ret > 0 then
os.exit(0);
else
- log("info", "Successfully daemonized to PID %d", pposix.getpid());
+ module:log("info", "Successfully daemonized to PID %d", pposix.getpid());
write_pidfile();
end
end
@@ -81,13 +81,13 @@ module:add_event_hook("server-stopped", remove_pidfile);
-- Set signal handler
if signal.signal then
signal.signal("SIGTERM", function ()
- log("warn", "Received SIGTERM...");
- unlock_globals();
- if prosody_shutdown then
- prosody_shutdown("Received SIGTERM");
+ module:log("warn", "Received SIGTERM...");
+ _G.unlock_globals();
+ if _G.prosody_shutdown then
+ _G.prosody_shutdown("Received SIGTERM");
else
- log("warn", "...no prosody_shutdown(), ignoring.");
+ module:log("warn", "...no prosody_shutdown(), ignoring.");
end
- lock_globals();
+ _G.lock_globals();
end);
end