diff options
-rw-r--r-- | lib/util/debug.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/util/debug.c b/lib/util/debug.c index 135cdb69fb9..8033c802712 100644 --- a/lib/util/debug.c +++ b/lib/util/debug.c @@ -1069,8 +1069,11 @@ bool reopen_logs_internal(void) force_check_log_size(); (void)umask(oldumask); - /* Take over stderr to catch output into logs */ - if (state.fd > 0) { + /* + * If log file was opened or created successfully, take over stderr to + * catch output into logs. + */ + if (new_fd != -1) { if (dup2(state.fd, 2) == -1) { /* Close stderr too, if dup2 can't point it - at the logfile. There really isn't much |