Date: Sun, 27 Jan 2008 12:30:03 GMT From: Jaakko Heinonen <jh@saunalahti.fi> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/107171: [patch] systat(1) doesn't die when it's xterm is killed while it's running Message-ID: <200801271230.m0RCU35j096637@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/107171; it has been noted by GNATS. From: Jaakko Heinonen <jh@saunalahti.fi> 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 <errno.h> #include <ctype.h> #include <signal.h> +#include <stdlib.h> #include <termios.h> #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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801271230.m0RCU35j096637>