diff options
-rw-r--r-- | usr.bin/ssh/ssh.c | 13 |
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) + |