summaryrefslogtreecommitdiff
path: root/lib/util/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util/debug.c')
-rw-r--r--lib/util/debug.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/util/debug.c b/lib/util/debug.c
index a6388513c7..a7e2a0f78e 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -592,9 +592,14 @@ bool reopen_logs_internal(void)
(void)umask(oldumask);
/* Take over stderr to catch output into logs */
- if (state.fd > 0 && dup2(state.fd, 2) == -1) {
- close_low_fds(true); /* Close stderr too, if dup2 can't point it
- at the logfile */
+ if (state.fd > 0) {
+ if (dup2(state.fd, 2) == -1) {
+ /* Close stderr too, if dup2 can't point it -
+ at the logfile. There really isn't much
+ that can be done on such a fundemental
+ failure... */
+ close_low_fds(false, false, true);
+ }
}
state.reopening_logs = false;