aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-06-28 14:11:25 +0000
committerlandley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-06-28 14:11:25 +0000
commite4e03e041edc8fb19e66977ab3a162039ad8f14a (patch)
treec0277dbc990cfde1b30284b507f9e824d7c9458a
parent7f4d3a837ab5c35497224aa800e6c18b3eafa062 (diff)
downloadbusybox-w32-e4e03e041edc8fb19e66977ab3a162039ad8f14a.tar.gz
busybox-w32-e4e03e041edc8fb19e66977ab3a162039ad8f14a.tar.bz2
busybox-w32-e4e03e041edc8fb19e66977ab3a162039ad8f14a.zip
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... git-svn-id: svn://busybox.net/trunk/busybox@15540 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--procps/top.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/procps/top.c b/procps/top.c
index a97e557aa..172933cbe 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -388,6 +388,7 @@ static void reset_term(void)
388static void sig_catcher(int sig ATTRIBUTE_UNUSED) 388static void sig_catcher(int sig ATTRIBUTE_UNUSED)
389{ 389{
390 reset_term(); 390 reset_term();
391 exit(1);
391} 392}
392#endif /* CONFIG_FEATURE_USE_TERMIOS */ 393#endif /* CONFIG_FEATURE_USE_TERMIOS */
393 394
@@ -423,11 +424,7 @@ int top_main(int argc, char **argv)
423 new_settings.c_lflag &= ~(ECHO | ECHONL); 424 new_settings.c_lflag &= ~(ECHO | ECHONL);
424 425
425 signal(SIGTERM, sig_catcher); 426 signal(SIGTERM, sig_catcher);
426 sigaction(SIGTERM, (struct sigaction *) 0, &sa); 427 signal(SIGINT, sig_catcher);
427 sa.sa_flags |= SA_RESTART;
428 sa.sa_flags &= ~SA_INTERRUPT;
429 sigaction(SIGTERM, &sa, (struct sigaction *) 0);
430 sigaction(SIGINT, &sa, (struct sigaction *) 0);
431 tcsetattr(0, TCSANOW, (void *) &new_settings); 428 tcsetattr(0, TCSANOW, (void *) &new_settings);
432 atexit(reset_term); 429 atexit(reset_term);
433#endif /* CONFIG_FEATURE_USE_TERMIOS */ 430#endif /* CONFIG_FEATURE_USE_TERMIOS */