From owner-svn-src-stable-8@FreeBSD.ORG Sun Nov 15 14:11:27 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89D551065670; Sun, 15 Nov 2009 14:11:27 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 78C8B8FC1C; Sun, 15 Nov 2009 14:11:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAFEBRbq039615; Sun, 15 Nov 2009 14:11:27 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAFEBRhI039614; Sun, 15 Nov 2009 14:11:27 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <200911151411.nAFEBRhI039614@svn.freebsd.org> From: Jaakko Heinonen Date: Sun, 15 Nov 2009 14:11:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199290 - stable/8/usr.bin/systat X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Nov 2009 14:11:27 -0000 Author: jh Date: Sun Nov 15 14:11:26 2009 New Revision: 199290 URL: http://svn.freebsd.org/changeset/base/199290 Log: MFC r197956: - Catch SIGHUP to perform cleanup before exiting. - Exit if getch() returns with an error other than EINTR. Otherwise systat(1) may get stuck in an infinite loop if it doesn't receive SIGHUP when terminal closes. - Remove attempt to clear stdio error indicators. getch() doesn't use stdio, making it useless. - Remove unneeded masking of getch() return value. PR: bin/107171 Approved by: trasz (mentor) Modified: stable/8/usr.bin/systat/keyboard.c stable/8/usr.bin/systat/main.c Directory Properties: stable/8/usr.bin/systat/ (props changed) Modified: stable/8/usr.bin/systat/keyboard.c ============================================================================== --- stable/8/usr.bin/systat/keyboard.c Sun Nov 15 11:43:28 2009 (r199289) +++ stable/8/usr.bin/systat/keyboard.c Sun Nov 15 14:11:26 2009 (r199290) @@ -39,8 +39,10 @@ __FBSDID("$FreeBSD$"); static const char sccsid[] = "@(#)keyboard.c 8.1 (Berkeley) 6/6/93"; #endif +#include #include #include +#include #include #include "systat.h" @@ -57,10 +59,11 @@ keyboard(void) move(CMDLINE, 0); do { refresh(); - ch = getch() & 0177; - if (ch == 0177 && ferror(stdin)) { - clearerr(stdin); - continue; + ch = getch(); + if (ch == ERR) { + if (errno == EINTR) + continue; + exit(1); } if (ch >= 'A' && ch <= 'Z') ch += 'a' - 'A'; Modified: stable/8/usr.bin/systat/main.c ============================================================================== --- stable/8/usr.bin/systat/main.c Sun Nov 15 11:43:28 2009 (r199289) +++ stable/8/usr.bin/systat/main.c Sun Nov 15 14:11:26 2009 (r199290) @@ -133,6 +133,7 @@ main(int argc, char **argv) exit(1); } } + signal(SIGHUP, die); signal(SIGINT, die); signal(SIGQUIT, die); signal(SIGTERM, die);