# HG changeset patch # User Kim Alvefur # Date 1633036927 -7200 # Node ID 7fe2fbfbdb1cf9ed789c6ba589e1727521d5f012 # Parent 4fad0ca42f6604df03cccf75adcb24fe46c53cd1 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. diff -r 4fad0ca42f66 -r 7fe2fbfbdb1c plugins/mod_posix.lua --- a/plugins/mod_posix.lua Thu Sep 30 17:47:00 2021 +0200 +++ b/plugins/mod_posix.lua Thu Sep 30 23:22:07 2021 +0200 @@ -35,7 +35,7 @@ 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 @@ 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()));