summaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'log.c')
-rw-r--r--log.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/log.c b/log.c
index 1749af6d1..5ebae1480 100644
--- a/log.c
+++ b/log.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: log.c,v 1.51 2018/07/27 12:03:17 markus Exp $ */ 1/* $OpenBSD: log.c,v 1.52 2020/07/03 06:46:41 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -371,6 +371,14 @@ log_redirect_stderr_to(const char *logfile)
371{ 371{
372 int fd; 372 int fd;
373 373
374 if (logfile == NULL) {
375 if (log_stderr_fd != STDERR_FILENO) {
376 close(log_stderr_fd);
377 log_stderr_fd = STDERR_FILENO;
378 }
379 return;
380 }
381
374 if ((fd = open(logfile, O_WRONLY|O_CREAT|O_APPEND, 0600)) == -1) { 382 if ((fd = open(logfile, O_WRONLY|O_CREAT|O_APPEND, 0600)) == -1) {
375 fprintf(stderr, "Couldn't open logfile %s: %s\n", logfile, 383 fprintf(stderr, "Couldn't open logfile %s: %s\n", logfile,
376 strerror(errno)); 384 strerror(errno));