diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2016-10-18 12:41:23 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2016-10-18 12:41:23 +0000 |
commit | 761cd47a3556c1c75ca575c94eeb9d90a164172b (patch) | |
tree | 4d386f0664c1b51185f66468cba9600f01019b30 /usr.bin | |
parent | 3c4d58c38920f1dc18f39accc4aeb21ec29d08b8 (diff) |
Install a signal handler for tty-generated signals and wait for the
ssh child to suspend before suspending sftp. This lets ssh restore
the terminal mode as needed when it is suspended at the password
prompt. OK dtucker@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/sftp.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/usr.bin/ssh/sftp.c b/usr.bin/ssh/sftp.c index c34e8367e4d..063cd2d8c98 100644 --- a/usr.bin/ssh/sftp.c +++ b/usr.bin/ssh/sftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp.c,v 1.176 2016/09/12 01:22:38 deraadt Exp $ */ +/* $OpenBSD: sftp.c,v 1.177 2016/10/18 12:41:22 millert Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> * @@ -210,6 +210,18 @@ killchild(int signo) /* ARGSUSED */ static void +suspchild(int signo) +{ + if (sshpid > 1) { + kill(sshpid, signo); + while (waitpid(sshpid, NULL, WUNTRACED) == -1 && errno == EINTR) + continue; + } + kill(getpid(), SIGSTOP); +} + +/* ARGSUSED */ +static void cmd_interrupt(int signo) { const char msg[] = "\rInterrupt \n"; @@ -2171,6 +2183,9 @@ connect_to_server(char *path, char **args, int *in, int *out) signal(SIGTERM, killchild); signal(SIGINT, killchild); signal(SIGHUP, killchild); + signal(SIGTSTP, suspchild); + signal(SIGTTIN, suspchild); + signal(SIGTTOU, suspchild); close(c_in); close(c_out); } |