From 6c7feac462383f750f6e96a3e1fc86da535e3051 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Thu, 23 Sep 2004 13:00:05 +0000 Subject: correctly honour -n in multiplex client mode; spotted by sturm@ ok markus@ --- usr.bin/ssh/ssh.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index 1066c84eb66..49eacaa42da 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/ssh.c @@ -40,7 +40,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh.c,v 1.227 2004/09/15 00:46:01 deraadt Exp $"); +RCSID("$OpenBSD: ssh.c,v 1.228 2004/09/23 13:00:04 djm Exp $"); #include #include @@ -1237,11 +1237,20 @@ static void control_client(const char *path) { struct sockaddr_un addr; - int i, r, sock, exitval, num_env; + int i, r, fd, sock, exitval, num_env; Buffer m; char *cp; extern char **environ; + if (stdin_null_flag) { + if ((fd = open(_PATH_DEVNULL, O_RDONLY)) == -1) + fatal("open(/dev/null): %s", strerror(errno)); + if (dup2(fd, STDIN_FILENO) == -1) + fatal("dup2: %s", strerror(errno)); + if (fd > STDERR_FILENO) + close(fd); + } + memset(&addr, '\0', sizeof(addr)); addr.sun_family = AF_UNIX; addr.sun_len = offsetof(struct sockaddr_un, sun_path) + -- cgit v1.2.3