upstream commit
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@ Upstream-ID: a31c1f42aa3e2985dcc91e46e6a17bd22e372d69
This commit is contained in:
parent
fd2a8f1033
commit
2c6697c443
17
sftp.c
17
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>
|
||||
*
|
||||
|
@ -230,6 +230,18 @@ killchild(int signo)
|
|||
_exit(1);
|
||||
}
|
||||
|
||||
/* 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)
|
||||
|
@ -2213,6 +2225,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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue