From owner-freebsd-bugs@FreeBSD.ORG Sun Jan 27 12:30:03 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C06B216A419 for ; Sun, 27 Jan 2008 12:30:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id ADC9B13C457 for ; Sun, 27 Jan 2008 12:30:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m0RCU3QV096638 for ; Sun, 27 Jan 2008 12:30:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m0RCU35j096637; Sun, 27 Jan 2008 12:30:03 GMT (envelope-from gnats) Date: Sun, 27 Jan 2008 12:30:03 GMT Message-Id: <200801271230.m0RCU35j096637@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Jaakko Heinonen Cc: Subject: Re: bin/107171: [patch] systat(1) doesn't die when it's xterm is killed while it's running X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jaakko Heinonen List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jan 2008 12:30:03 -0000 The following reply was made to PR bin/107171; it has been noted by GNATS. From: Jaakko Heinonen To: bug-followup@FreeBSD.org, josh@tcbug.org Cc: Subject: Re: bin/107171: [patch] systat(1) doesn't die when it's xterm is killed while it's running Date: Sun, 27 Jan 2008 14:19:53 +0200 --ibTvN161/egqYuK8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Updated patch to add a missing include for stdlib.h in keyboard.c. (For exit(3) prototype.) --ibTvN161/egqYuK8 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="systat-hang-on-getch-loop-fix.patch" Index: main.c =================================================================== RCS file: /home/ncvs/src/usr.bin/systat/main.c,v retrieving revision 1.21 diff -u -r1.21 main.c --- main.c 16 Jan 2008 19:27:43 -0000 1.21 +++ main.c 26 Jan 2008 21:01:28 -0000 @@ -136,6 +136,7 @@ signal(SIGINT, die); signal(SIGQUIT, die); signal(SIGTERM, die); + signal(SIGHUP, die); /* * Initialize display. Load average appears in a one line Index: keyboard.c =================================================================== RCS file: /home/ncvs/src/usr.bin/systat/keyboard.c,v retrieving revision 1.3 diff -u -r1.3 keyboard.c --- keyboard.c 16 Jan 2008 19:27:43 -0000 1.3 +++ keyboard.c 27 Jan 2008 12:10:25 -0000 @@ -39,8 +39,10 @@ static const char sccsid[] = "@(#)keyboard.c 8.1 (Berkeley) 6/6/93"; #endif +#include #include #include +#include #include #include "systat.h" @@ -57,7 +59,12 @@ move(CMDLINE, 0); do { refresh(); - ch = getch() & 0177; + if ((ch = getch()) == ERR) { + if (errno == EINTR) + continue; + exit(1); + } + ch &= 0177; if (ch == 0177 && ferror(stdin)) { clearerr(stdin); continue; --ibTvN161/egqYuK8--