# HG changeset patch # User Kim Alvefur # Date 1770487947 -3600 # Node ID f20b3f0d892bf496aa8201ab6ce89bc260973349 # Parent 797f4c7e5f3e91da6c1a7816ca5601b194407ba0# Parent 312542dd184d544b73cf8ca80027726a099e12ac Merge 13.0->trunk diff -r 797f4c7e5f3e -r f20b3f0d892b prosody --- a/prosody Tue Feb 03 11:01:03 2026 +0000 +++ b/prosody Sat Feb 07 19:12:27 2026 +0100 @@ -18,14 +18,21 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -local function is_relative(path) - local path_sep = package.config:sub(1,1); - return ((path_sep == "/" and path:sub(1,1) ~= "/") - or (path_sep == "\\" and (path:sub(1,1) ~= "/" and path:sub(2,3) ~= ":\\"))) +-- Check before first require, to preempt the probable failure +if _VERSION < "Lua 5.2" then + io.stderr:write("Prosody is no longer compatible with Lua 5.1\n") + io.stderr:write("See https://prosody.im/doc/depends#lua for more information\n") + return os.exit(1); end -- Tell Lua where to find our libraries if CFG_SOURCEDIR then + -- Installed instance + local function is_relative(path) + local path_sep = package.config:sub(1,1); + return ((path_sep == "/" and path:sub(1,1) ~= "/") + or (path_sep == "\\" and (path:sub(1,1) ~= "/" and path:sub(2,3) ~= ":\\"))) + end local function filter_relative_paths(path) if is_relative(path) then return ""; end end @@ -34,6 +41,11 @@ end package.path = sanitise_paths(CFG_SOURCEDIR.."/?.lua;"..package.path); package.cpath = sanitise_paths(CFG_SOURCEDIR.."/?.so;"..package.cpath); + + require "prosody.loader"; +else + -- Not installed, e.g. running from a source checkout + require "loader"; end -- Substitute ~ with path to home directory in data path @@ -44,17 +56,6 @@ end --- Check before first require, to preempt the probable failure -if _VERSION < "Lua 5.2" then - io.stderr:write("Prosody is no longer compatible with Lua 5.1\n") - io.stderr:write("See https://prosody.im/doc/depends#lua for more information\n") - return os.exit(1); -end - -if not pcall(require, "prosody.loader") then - pcall(require, "loader"); -end - local startup = require "prosody.util.startup"; local async = require "prosody.util.async"; diff -r 797f4c7e5f3e -r f20b3f0d892b prosodyctl --- a/prosodyctl Tue Feb 03 11:01:03 2026 +0000 +++ b/prosodyctl Sat Feb 07 19:12:27 2026 +0100 @@ -17,14 +17,22 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -local function is_relative(path) - local path_sep = package.config:sub(1,1); - return ((path_sep == "/" and path:sub(1,1) ~= "/") - or (path_sep == "\\" and (path:sub(1,1) ~= "/" and path:sub(2,3) ~= ":\\"))) +-- Check before first require, to preempt the probable failure +if _VERSION < "Lua 5.2" then + io.stderr:write("Prosody is no longer compatible with Lua 5.1\n") + io.stderr:write("See https://prosody.im/doc/depends#lua for more information\n") + return os.exit(1); end + -- Tell Lua where to find our libraries if CFG_SOURCEDIR then + -- Installed instance + local function is_relative(path) + local path_sep = package.config:sub(1,1); + return ((path_sep == "/" and path:sub(1,1) ~= "/") + or (path_sep == "\\" and (path:sub(1,1) ~= "/" and path:sub(2,3) ~= ":\\"))) + end local function filter_relative_paths(path) if is_relative(path) then return ""; end end @@ -33,6 +41,11 @@ end package.path = sanitise_paths(CFG_SOURCEDIR.."/?.lua;"..package.path); package.cpath = sanitise_paths(CFG_SOURCEDIR.."/?.so;"..package.cpath); + + require "prosody.loader"; +else + -- Not installed, e.g. running from a source checkout + require "loader"; end -- Substitute ~ with path to home directory in data path @@ -42,18 +55,6 @@ end end ------------ - --- Check before first require, to preempt the probable failure -if _VERSION < "Lua 5.2" then - io.stderr:write("Prosody is no longer compatible with Lua 5.1\n") - io.stderr:write("See https://prosody.im/doc/depends#lua for more information\n") - return os.exit(1); -end - -if not pcall(require, "prosody.loader") then - pcall(require, "loader"); -end local startup = require "prosody.util.startup"; startup.prosodyctl(); diff -r 797f4c7e5f3e -r f20b3f0d892b util-src/pposix.c --- a/util-src/pposix.c Tue Feb 03 11:01:03 2026 +0000 +++ b/util-src/pposix.c Sat Feb 07 19:12:27 2026 +0100 @@ -123,9 +123,17 @@ } /* Make sure accidental use of FDs 0, 1, 2 don't cause weirdness */ - freopen("/dev/null", "r", stdin); - freopen("/dev/null", "w", stdout); - freopen("/dev/null", "w", stderr); + if(!freopen("/dev/null", "r", stdin)) { + fprintf(stderr, "Failed to redirect stdin to /dev/null"); + } + + if(!freopen("/dev/null", "w", stdout)) { + fprintf(stderr, "Failed to redirect stdout to /dev/null"); + } + + if(!freopen("/dev/null", "w", stderr)) { + fprintf(stderr, "Failed to redirect stderr to /dev/null"); + } /* Final fork, use it wisely */ if(fork()) {