diff options
author | Martin Schwenke <martin@meltin.net> | 2022-06-07 13:54:20 +1000 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2022-06-16 12:42:35 +0000 |
commit | a8091bd0c565a3f14542731e642319dbb68b4786 (patch) | |
tree | 39cbbba993b0c75f84c349a8521595e5fec85e2e /lib | |
parent | d9e561a89a26078cccaf279a450203d5195ff445 (diff) | |
download | samba-a8091bd0c565a3f14542731e642319dbb68b4786.tar.gz |
util: Add new debug setting debug_no_stderr_redirect
CTDB doesn't want this redirection of stderr to the log file. It
expects to be able to capture stderr of subprocesses and log them with
a header. This redirection stops that from happening.
Unfortunately this has to be a negative option (i.e. "no" in the name)
so that the default of 0/false maintains existing behaviour.
Note that the default behaviour is sub-optimal because it causes raw
data (i.e. debug data without a header) to appear in the log.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15090
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util/debug.c | 3 | ||||
-rw-r--r-- | lib/util/debug.h | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/util/debug.c b/lib/util/debug.c index 8484094d014..7f9231eac2e 100644 --- a/lib/util/debug.c +++ b/lib/util/debug.c @@ -1324,7 +1324,8 @@ bool reopen_logs_internal(void) * If log file was opened or created successfully, take over stderr to * catch output into logs. */ - if (dbgc_config[DBGC_ALL].fd > 0) { + if (!state.settings.debug_no_stderr_redirect && + dbgc_config[DBGC_ALL].fd > 0) { if (dup2(dbgc_config[DBGC_ALL].fd, 2) == -1) { /* Close stderr too, if dup2 can't point it - at the logfile. There really isn't much diff --git a/lib/util/debug.h b/lib/util/debug.h index a9f3a41cde4..9aeec853e64 100644 --- a/lib/util/debug.h +++ b/lib/util/debug.h @@ -305,6 +305,7 @@ struct debug_settings { bool debug_pid; bool debug_uid; bool debug_class; + bool debug_no_stderr_redirect; }; void setup_logging(const char *prog_name, enum debug_logtype new_logtype); |