From: Denys Vlasenko Date: Wed, 26 Sep 2012 14:58:25 +0000 (+0200) Subject: top: do not touch stdin if -b X-Git-Tag: 1_21_0~67 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=73a19908975948154d1a07c3550592059238e9ef;p=oweals%2Fbusybox.git top: do not touch stdin if -b Signed-off-by: Denys Vlasenko --- diff --git a/procps/top.c b/procps/top.c index dc5ea7360..1977fcafc 100644 --- a/procps/top.c +++ b/procps/top.c @@ -717,7 +717,8 @@ static void clearmems(void) static void reset_term(void) { - tcsetattr_stdin_TCSANOW(&initial_settings); + if (!OPT_BATCH_MODE) + tcsetattr_stdin_TCSANOW(&initial_settings); if (ENABLE_FEATURE_CLEAN_UP) { clearmems(); # if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE @@ -729,7 +730,7 @@ static void reset_term(void) static void sig_catcher(int sig UNUSED_PARAM) { reset_term(); - _exit(EXIT_FAILURE); + kill_myself_with_sig(sig); } #endif /* FEATURE_USE_TERMIOS */ @@ -919,6 +920,12 @@ static unsigned handle_input(unsigned scan_mask, unsigned interval) { struct pollfd pfd[1]; + if (option_mask32 & OPT_EOF) { + /* EOF on stdin ("top