summaryrefslogtreecommitdiffstats
path: root/log.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2020-07-03 08:46:41 +0200
committerDamien Miller <djm@mindrot.org>2020-07-03 09:03:54 +0200
commitc8935081db35d73ee6355999142fa0776a2af912 (patch)
tree1bf5f1086d43b9087b8604a7a5d8f20d3eca788e /log.c
parentupstream: start ClientAliveInterval bookkeeping before first pass (diff)
downloadopenssh-c8935081db35d73ee6355999142fa0776a2af912.tar.xz
openssh-c8935081db35d73ee6355999142fa0776a2af912.zip
upstream: when redirecting sshd's log output to a file, undo this
redirection after the session child process is forked(); ok dtucker@ OpenBSD-Commit-ID: 6df86dd653c91f5bc8ac1916e7680d9d24690865
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 d9c2d136c..6b1a7a314 100644
--- a/log.c
+++ b/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.51 2018/07/27 12:03:17 markus Exp $ */
+/* $OpenBSD: log.c,v 1.52 2020/07/03 06:46:41 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -370,6 +370,14 @@ log_redirect_stderr_to(const char *logfile)
{
int fd;
+ if (logfile == NULL) {
+ if (log_stderr_fd != STDERR_FILENO) {
+ close(log_stderr_fd);
+ log_stderr_fd = STDERR_FILENO;
+ }
+ return;
+ }
+
if ((fd = open(logfile, O_WRONLY|O_CREAT|O_APPEND, 0600)) == -1) {
fprintf(stderr, "Couldn't open logfile %s: %s\n", logfile,
strerror(errno));