[openssh-commits] [openssh] 03/03: upstream commit
git+noreply at mindrot.org
git+noreply at mindrot.org
Fri Apr 29 18:09:11 AEST 2016
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit d2d6bf864e52af8491a60dd507f85b74361f5da3
Author: djm at openbsd.org <djm at openbsd.org>
Date: Fri Apr 29 08:07:53 2016 +0000
upstream commit
close ControlPersist background process stderr when not
in debug mode or when logging to a file or syslog. bz#1988 ok dtucker
Upstream-ID: 4fb726f0fdcb155ad419913cea10dc4afd409d24
---
log.c | 4 ++--
ssh.c | 8 +++++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/log.c b/log.c
index ad12930..277afda 100644
--- a/log.c
+++ b/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.46 2015/07/08 19:04:21 markus Exp $ */
+/* $OpenBSD: log.c,v 1.47 2016/04/29 08:07:53 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo at cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -342,7 +342,7 @@ log_change_level(LogLevel new_log_level)
int
log_is_on_stderr(void)
{
- return log_on_stderr;
+ return log_on_stderr && log_stderr_fd == STDERR_FILENO;
}
/* redirect what would usually get written to stderr to specified file */
diff --git a/ssh.c b/ssh.c
index a999d50..a881ba1 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.437 2016/03/07 19:02:43 djm Exp $ */
+/* $OpenBSD: ssh.c,v 1.438 2016/04/29 08:07:53 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo at cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -1395,7 +1395,7 @@ static void
control_persist_detach(void)
{
pid_t pid;
- int devnull;
+ int devnull, keep_stderr;
debug("%s: backgrounding master process", __func__);
@@ -1426,8 +1426,10 @@ control_persist_detach(void)
error("%s: open(\"/dev/null\"): %s", __func__,
strerror(errno));
} else {
+ keep_stderr = log_is_on_stderr() && debug_flag;
if (dup2(devnull, STDIN_FILENO) == -1 ||
- dup2(devnull, STDOUT_FILENO) == -1)
+ dup2(devnull, STDOUT_FILENO) == -1 ||
+ (!keep_stderr && dup2(devnull, STDERR_FILENO) == -1))
error("%s: dup2: %s", __func__, strerror(errno));
if (devnull > STDERR_FILENO)
close(devnull);
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list