diff options
author | Kim Alvefur <zash@zash.se> | 2021-09-30 23:22:07 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-09-30 23:22:07 +0200 |
commit | bd8604331f8eddd8fe7bc0d24e6030dfb02b38ee (patch) | |
tree | 9ff2af97fae5ccbabc1173748a9871fed9d22e48 | |
parent | d0026b7941a96407487398d32fafb0171ad34906 (diff) | |
download | prosody-bd8604331f8eddd8fe7bc0d24e6030dfb02b38ee.tar.gz prosody-bd8604331f8eddd8fe7bc0d24e6030dfb02b38ee.zip |
mod_posix: Exit with non-zero status code on problems
Previously it would default to exit with 0 as status code, meaning
success, which is weird.
-rw-r--r-- | plugins/mod_posix.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/mod_posix.lua b/plugins/mod_posix.lua index 03177530..3ef8a632 100644 --- a/plugins/mod_posix.lua +++ b/plugins/mod_posix.lua @@ -35,7 +35,7 @@ if not prosody.start_time then -- server-starting if pposix.getuid() == 0 and not module:get_option_boolean("run_as_root") then module:log("error", "Danger, Will Robinson! Prosody doesn't need to be run as root, so don't do it!"); module:log("error", "For more information on running Prosody as root, see https://prosody.im/doc/root"); - prosody.shutdown("Refusing to run as root"); + prosody.shutdown("Refusing to run as root", 1); end end @@ -61,19 +61,19 @@ local function write_pidfile() pidfile_handle, err = io.open(pidfile, mode); if not pidfile_handle then module:log("error", "Couldn't write pidfile at %s; %s", pidfile, err); - prosody.shutdown("Couldn't write pidfile"); + prosody.shutdown("Couldn't write pidfile", 1); else if not lfs.lock(pidfile_handle, "w") then -- Exclusive lock local other_pid = pidfile_handle:read("*a"); module:log("error", "Another Prosody instance seems to be running with PID %s, quitting", other_pid); pidfile_handle = nil; - prosody.shutdown("Prosody already running"); + prosody.shutdown("Prosody already running", 1); 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"); + prosody.shutdown("Couldn't write pidfile", 1); else if lfs.lock(pidfile_handle, "w") then pidfile_handle:write(tostring(pposix.getpid())); |