=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/clientloop.c,v retrieving revision 1.104 retrieving revision 1.104.2.1 diff -u -r1.104 -r1.104.2.1 --- src/usr.bin/ssh/clientloop.c 2002/08/22 19:38:42 1.104 +++ src/usr.bin/ssh/clientloop.c 2003/04/01 00:12:13 1.104.2.1 @@ -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.104.2.1 2003/04/01 00:12:13 margarida Exp $"); #include "ssh.h" #include "ssh1.h" @@ -888,10 +888,16 @@ 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);