summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/util/debug.c3
-rw-r--r--lib/util/debug.h1
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);