summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/ssh.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2004-09-23 13:00:05 +0000
committerDamien Miller <djm@cvs.openbsd.org>2004-09-23 13:00:05 +0000
commit6c7feac462383f750f6e96a3e1fc86da535e3051 (patch)
tree1e34a09fcfb1943508d15870c4e15ef9cbd61a87 /usr.bin/ssh/ssh.c
parent8e6a31954e4a42be990bc33fcd59d1f74630ca24 (diff)
correctly honour -n in multiplex client mode; spotted by sturm@ ok markus@
Diffstat (limited to 'usr.bin/ssh/ssh.c')
-rw-r--r--usr.bin/ssh/ssh.c13
1 files 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 <openssl/evp.h>
#include <openssl/err.h>
@@ -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) +