diff options
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 20 |
1 files changed, 8 insertions, 12 deletions
@@ -33,7 +33,7 @@ | |||
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include "includes.h" | 35 | #include "includes.h" |
36 | RCSID("$OpenBSD: session.c,v 1.102 2001/09/16 14:46:54 markus Exp $"); | 36 | RCSID("$OpenBSD: session.c,v 1.103 2001/10/06 00:36:42 markus Exp $"); |
37 | 37 | ||
38 | #include "ssh.h" | 38 | #include "ssh.h" |
39 | #include "ssh1.h" | 39 | #include "ssh1.h" |
@@ -560,17 +560,13 @@ do_exec_pty(Session *s, const char *command) | |||
560 | /* Make the pseudo tty our controlling tty. */ | 560 | /* Make the pseudo tty our controlling tty. */ |
561 | pty_make_controlling_tty(&ttyfd, s->tty); | 561 | pty_make_controlling_tty(&ttyfd, s->tty); |
562 | 562 | ||
563 | /* Redirect stdin from the pseudo tty. */ | 563 | /* Redirect stdin/stdout/stderr from the pseudo tty. */ |
564 | if (dup2(ttyfd, fileno(stdin)) < 0) | 564 | if (dup2(ttyfd, 0) < 0) |
565 | error("dup2 stdin failed: %.100s", strerror(errno)); | 565 | error("dup2 stdin: %s", strerror(errno)); |
566 | 566 | if (dup2(ttyfd, 1) < 0) | |
567 | /* Redirect stdout to the pseudo tty. */ | 567 | error("dup2 stdout: %s", strerror(errno)); |
568 | if (dup2(ttyfd, fileno(stdout)) < 0) | 568 | if (dup2(ttyfd, 2) < 0) |
569 | error("dup2 stdin failed: %.100s", strerror(errno)); | 569 | error("dup2 stderr: %s", strerror(errno)); |
570 | |||
571 | /* Redirect stderr to the pseudo tty. */ | ||
572 | if (dup2(ttyfd, fileno(stderr)) < 0) | ||
573 | error("dup2 stdin failed: %.100s", strerror(errno)); | ||
574 | 570 | ||
575 | /* Close the extra descriptor for the pseudo tty. */ | 571 | /* Close the extra descriptor for the pseudo tty. */ |
576 | close(ttyfd); | 572 | close(ttyfd); |