summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/clientloop.c
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2002-11-18 16:43:44 +0000
committermarkus <markus@openbsd.org>2002-11-18 16:43:44 +0000
commitd7519a114e4152b8841deaad616b38f138445d48 (patch)
tree5eb156ec7f0cccc0613a382615fc03f9e580fe38 /usr.bin/ssh/clientloop.c
parentkill unused #define which was a workaround with old OpenSSL versions (diff)
downloadwireguard-openbsd-d7519a114e4152b8841deaad616b38f138445d48.tar.xz
wireguard-openbsd-d7519a114e4152b8841deaad616b38f138445d48.zip
don't overwrite SIG{INT,QUIT,TERM} handler if set to SIG_IGN;
e.g. if ssh is used for backup; report Joerg Schilling; ok millert@
Diffstat (limited to 'usr.bin/ssh/clientloop.c')
-rw-r--r--usr.bin/ssh/clientloop.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/usr.bin/ssh/clientloop.c b/usr.bin/ssh/clientloop.c
index 2c030e71b36..fcd75d2d727 100644
--- a/usr.bin/ssh/clientloop.c
+++ b/usr.bin/ssh/clientloop.c
@@ -59,7 +59,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: clientloop.c,v 1.104 2002/08/22 19:38:42 stevesk Exp $");
+RCSID("$OpenBSD: clientloop.c,v 1.105 2002/11/18 16:43:44 markus Exp $");
#include "ssh.h"
#include "ssh1.h"
@@ -888,10 +888,16 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
client_init_dispatch();
- /* Set signal handlers to restore non-blocking mode. */
- signal(SIGINT, signal_handler);
- signal(SIGQUIT, signal_handler);
- signal(SIGTERM, signal_handler);
+ /*
+ * Set signal handlers, (e.g. to restore non-blocking mode)
+ * but don't overwrite SIG_IGN, matches behaviour from rsh(1)
+ */
+ if (signal(SIGINT, SIG_IGN) != SIG_IGN)
+ signal(SIGINT, signal_handler);
+ if (signal(SIGQUIT, SIG_IGN) != SIG_IGN)
+ signal(SIGQUIT, signal_handler);
+ if (signal(SIGTERM, SIG_IGN) != SIG_IGN)
+ signal(SIGTERM, signal_handler);
if (have_pty)
signal(SIGWINCH, window_change_handler);