SCP: Ignore subsequent SIGTERM receipt after initial receipt.

The OS may signal SIGTERM more than once before ultimately
issuing a SIGKILL.  The initial SIGTERM will stop execution and
initiate optional simulator cleanup.  Ignoring follow up SIGTERMs
will allow as much cleanup as possible to be achieved and thus
allow the simulator to complete its cleanup and exit or ultimately
exit die due to receipt of SIGKILL.

Likewise for SIGHUP on hosts that can issue SIGHUP.
This commit is contained in:
Mark Pizzolato 2020-09-17 14:00:10 -07:00
parent eaa6944551
commit 2a75aa630c

4
scp.c
View file

@ -8640,9 +8640,9 @@ sim_stop_timer_services (); /* disable wall clock ti
sim_ttcmd (); /* restore console */
sim_brk_clrall (BRK_TYP_DYN_STEPOVER); /* cancel any step/over subroutine breakpoints */
#ifdef SIGHUP
signal (SIGHUP, SIG_DFL); /* cancel WRU */
signal (SIGHUP, sigterm_received ? SIG_IGN : SIG_DFL); /* cancel WRU */
#endif
signal (SIGTERM, SIG_DFL); /* cancel WRU */
signal (SIGTERM, sigterm_received ? SIG_IGN : SIG_DFL); /* cancel WRU */
sim_flush_buffered_files();
sim_cancel (&sim_flush_unit); /* cancel flush timer */
sim_cancel_step (); /* cancel step timer */