Software /
code /
prosody
Changeset
3341:a8a3e662fea7
mod_posix: Some (perhaps temporary) changes to re-lock the pidfile after truncating, to avoid breaking prosodyctl
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 09 Jul 2010 01:23:54 +0100 |
parents | 3340:0769cc5f34b6 |
children | 3342:20e99763a08a |
files | plugins/mod_posix.lua |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_posix.lua Fri Jul 09 01:16:09 2010 +0100 +++ b/plugins/mod_posix.lua Fri Jul 09 01:23:54 2010 +0100 @@ -95,13 +95,17 @@ 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