diff options
author | Kim Alvefur <zash@zash.se> | 2024-03-24 21:32:00 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2024-03-24 21:32:00 +0100 |
commit | b41253bb4951c02b77f525d1a7cfc1e03a17b337 (patch) | |
tree | 0fd8eb576e2e8971adb7bdb2959a0ac262b914fd /util/startup.lua | |
parent | 78be92ab7033d14fd809f0af80f80bbc0c63cb16 (diff) | |
download | prosody-b41253bb4951c02b77f525d1a7cfc1e03a17b337.tar.gz prosody-b41253bb4951c02b77f525d1a7cfc1e03a17b337.zip |
util.startup: Abort before initialization of logging when started as root
Prevents creation of log files owned by the root user which could be
inaccessible once started correctly.
Diffstat (limited to 'util/startup.lua')
-rw-r--r-- | util/startup.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/util/startup.lua b/util/startup.lua index 997e599a..7f0c4354 100644 --- a/util/startup.lua +++ b/util/startup.lua @@ -692,8 +692,8 @@ function startup.check_user() if not pposix then return end -- Don't even think about it! if pposix.getuid() == 0 and not config.get("*", "run_as_root") then - log("error", "Danger, Will Robinson! Prosody doesn't need to be run as root, so don't do it!"); - log("error", "For more information on running Prosody as root, see https://prosody.im/doc/root"); + print("Danger, Will Robinson! Prosody doesn't need to be run as root, so don't do it!"); + print("For more information on running Prosody as root, see https://prosody.im/doc/root"); os.exit(1); -- Refusing to run as root end end @@ -864,8 +864,8 @@ function startup.prosody() startup.parse_args(); startup.init_global_state(); startup.read_config(); - startup.init_logging(); startup.check_user(); + startup.init_logging(); startup.init_gc(); startup.init_errors(); startup.sanity_check(); |