aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-07-09 01:23:54 +0100
committerMatthew Wild <mwild1@gmail.com>2010-07-09 01:23:54 +0100
commitb96ba1e82dd4e149c784507ee4ac1623e8f2eeab (patch)
tree1c858a954ace62a670325588d424ba5903efd50a /plugins
parentd77e181372113179273c8c03cec766ac1cf3a768 (diff)
downloadprosody-b96ba1e82dd4e149c784507ee4ac1623e8f2eeab.tar.gz
prosody-b96ba1e82dd4e149c784507ee4ac1623e8f2eeab.zip
mod_posix: Some (perhaps temporary) changes to re-lock the pidfile after truncating, to avoid breaking prosodyctl
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_posix.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/mod_posix.lua b/plugins/mod_posix.lua
index 11e3c418..77b2f2a4 100644
--- a/plugins/mod_posix.lua
+++ b/plugins/mod_posix.lua
@@ -95,13 +95,17 @@ local function write_pidfile()
pidfile_handle = nil;
prosody.shutdown("Prosody already running");
else
+ pidfile_handle:close();
pidfile_handle, err = io.open(pidfile, "w+");
if not pidfile_handle then
module:log("error", "Couldn't write pidfile at %s; %s", pidfile, err);
prosody.shutdown("Couldn't write pidfile");
+ else
+ if lfs.lock(pidfile_handle, "w") then
+ pidfile_handle:write(tostring(pposix.getpid()));
+ pidfile_handle:flush();
+ end
end
- pidfile_handle:write(tostring(pposix.getpid()));
- pidfile_handle:flush();
end
end
end