Top was catching sigterm (and fumbling sigint) so it could reset the terminal
type on the way out, but the signal handler didn't exit. Plus it did unnecessary things with sigaction. This code is overgrown and needs a serious weed-whacking...
This commit is contained in:
parent
ea7c18514b
commit
db1ab1aeb3
1 changed files with 2 additions and 5 deletions
|
@ -388,6 +388,7 @@ static void reset_term(void)
|
||||||
static void sig_catcher(int sig ATTRIBUTE_UNUSED)
|
static void sig_catcher(int sig ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
reset_term();
|
reset_term();
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_FEATURE_USE_TERMIOS */
|
#endif /* CONFIG_FEATURE_USE_TERMIOS */
|
||||||
|
|
||||||
|
@ -423,11 +424,7 @@ int top_main(int argc, char **argv)
|
||||||
new_settings.c_lflag &= ~(ECHO | ECHONL);
|
new_settings.c_lflag &= ~(ECHO | ECHONL);
|
||||||
|
|
||||||
signal(SIGTERM, sig_catcher);
|
signal(SIGTERM, sig_catcher);
|
||||||
sigaction(SIGTERM, (struct sigaction *) 0, &sa);
|
signal(SIGINT, sig_catcher);
|
||||||
sa.sa_flags |= SA_RESTART;
|
|
||||||
sa.sa_flags &= ~SA_INTERRUPT;
|
|
||||||
sigaction(SIGTERM, &sa, (struct sigaction *) 0);
|
|
||||||
sigaction(SIGINT, &sa, (struct sigaction *) 0);
|
|
||||||
tcsetattr(0, TCSANOW, (void *) &new_settings);
|
tcsetattr(0, TCSANOW, (void *) &new_settings);
|
||||||
atexit(reset_term);
|
atexit(reset_term);
|
||||||
#endif /* CONFIG_FEATURE_USE_TERMIOS */
|
#endif /* CONFIG_FEATURE_USE_TERMIOS */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue