diff options
author | djm@openbsd.org <djm@openbsd.org> | 2020-07-03 08:46:41 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2020-07-03 09:03:54 +0200 |
commit | c8935081db35d73ee6355999142fa0776a2af912 (patch) | |
tree | 1bf5f1086d43b9087b8604a7a5d8f20d3eca788e /log.c | |
parent | upstream: start ClientAliveInterval bookkeeping before first pass (diff) | |
download | openssh-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.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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)); |