# HG changeset patch # User Kim Alvefur # Date 1352674118 -3600 # Node ID fa6d61f2fe206cf4deeecba3cdf4b0d750b209bd # Parent 42765c80244c0192005ec8ac06b64e1029de2d7d# Parent add9ad38208efe4de75bf8d2f64da834e7a6df98 Merge 0.9 -> trunk diff -r 42765c80244c -r fa6d61f2fe20 plugins/mod_posix.lua --- a/plugins/mod_posix.lua Wed Oct 24 19:56:22 2012 +0200 +++ b/plugins/mod_posix.lua Sun Nov 11 23:48:38 2012 +0100 @@ -136,8 +136,17 @@ end end +local function remove_log_sinks() + local lm = require "core.loggingmanager"; + lm.register_sink_type("console", nil); + lm.register_sink_type("stdout", nil); + lm.reload_logging(); +end + if daemonize then local function daemonize_server() + module:log("info", "Prosody is about to detach from the console, disabling further console output"); + remove_log_sinks(); local ok, ret = pposix.daemonize(); if not ok then module:log("error", "Failed to daemonize: %s", ret); diff -r 42765c80244c -r fa6d61f2fe20 util-src/pposix.c --- a/util-src/pposix.c Wed Oct 24 19:56:22 2012 +0200 +++ b/util-src/pposix.c Sun Nov 11 23:48:38 2012 +0100 @@ -89,6 +89,10 @@ close(0); close(1); close(2); + /* Make sure accidental use of FDs 0, 1, 2 don't cause weirdness */ + open("/dev/null", O_RDONLY); + open("/dev/null", O_WRONLY); + open("/dev/null", O_WRONLY); /* Final fork, use it wisely */ if(fork())