|
Lines 89-94
Link Here
|
| 89 |
*/ |
89 |
*/ |
| 90 |
static volatile sig_atomic_t child_terminated = 0; /* The child has terminated. */ |
90 |
static volatile sig_atomic_t child_terminated = 0; /* The child has terminated. */ |
|
|
91 |
static volatile sig_atomic_t received_sigterm = 0; |
| 91 |
/* prototypes */ |
92 |
/* prototypes */ |
| 92 |
static void server_init_dispatch(void); |
93 |
static void server_init_dispatch(void); |
|
Lines 151-156
Link Here
|
| 151 |
errno = save_errno; |
152 |
errno = save_errno; |
| 152 |
} |
153 |
} |
|
|
154 |
static void |
| 155 |
sigterm_handler(int sig) |
| 156 |
{ |
| 157 |
received_sigterm = 1; |
| 158 |
} |
| 159 |
|
| 153 |
/* |
160 |
/* |
| 154 |
* Make packets from buffered stderr data, and buffer it for sending |
161 |
* Make packets from buffered stderr data, and buffer it for sending |
| 155 |
* to the client. |
162 |
* to the client. |
|
Lines 501-506
Link Here
|
| 501 |
/* Initialize the SIGCHLD kludge. */ |
508 |
/* Initialize the SIGCHLD kludge. */ |
| 502 |
child_terminated = 0; |
509 |
child_terminated = 0; |
| 503 |
mysignal(SIGCHLD, sigchld_handler); |
510 |
mysignal(SIGCHLD, sigchld_handler); |
|
|
511 |
mysignal(SIGTERM, sigterm_handler); |
| 504 |
/* Initialize our global variables. */ |
512 |
/* Initialize our global variables. */ |
| 505 |
fdin = fdin_arg; |
513 |
fdin = fdin_arg; |
|
Lines 629-634
Link Here
|
| 629 |
wait_until_can_do_something(&readset, &writeset, &max_fd, |
637 |
wait_until_can_do_something(&readset, &writeset, &max_fd, |
| 630 |
&nalloc, max_time_milliseconds); |
638 |
&nalloc, max_time_milliseconds); |
|
|
639 |
if (received_sigterm) |
| 640 |
cleanup_exit(255); |
| 641 |
|
| 631 |
/* Process any channel events. */ |
642 |
/* Process any channel events. */ |
| 632 |
channel_after_select(readset, writeset); |
643 |
channel_after_select(readset, writeset); |
|
Lines 745-750
Link Here
|
| 745 |
debug("Entering interactive session for SSH2."); |
756 |
debug("Entering interactive session for SSH2."); |
| 746 |
mysignal(SIGCHLD, sigchld_handler); |
757 |
mysignal(SIGCHLD, sigchld_handler); |
|
|
758 |
mysignal(SIGTERM, sigterm_handler); |
| 747 |
child_terminated = 0; |
759 |
child_terminated = 0; |
| 748 |
connection_in = packet_get_connection_in(); |
760 |
connection_in = packet_get_connection_in(); |
| 749 |
connection_out = packet_get_connection_out(); |
761 |
connection_out = packet_get_connection_out(); |
|
Lines 775-780
Link Here
|
| 775 |
kex_send_kexinit(xxx_kex); |
787 |
kex_send_kexinit(xxx_kex); |
| 776 |
} |
788 |
} |
| 777 |
} |
789 |
} |
|
|
790 |
|
| 791 |
if (received_sigterm) |
| 792 |
cleanup_exit(255); |
| 793 |
|
| 778 |
process_input(readset); |
794 |
process_input(readset); |
| 779 |
if (connection_closed) |
795 |
if (connection_closed) |
| 780 |
break; |
796 |
break; |