Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/usr.bin/top Pull up revision 1.7 (requested by abs):



details:   https://anonhg.NetBSD.org/src/rev/396593978911
branches:  netbsd-1-5
changeset: 491315:396593978911
user:      he <he%NetBSD.org@localhost>
date:      Sun Apr 22 18:36:42 2001 +0000

description:
Pull up revision 1.7 (requested by abs):
  If the read() on stdin for a command fails, exit.  Prevents
  the program from spinning in certain conditions.

diffstat:

 usr.bin/top/top.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (19 lines):

diff -r b406bd41f447 -r 396593978911 usr.bin/top/top.c
--- a/usr.bin/top/top.c Sun Apr 22 18:33:59 2001 +0000
+++ b/usr.bin/top/top.c Sun Apr 22 18:36:42 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: top.c,v 1.4.8.1 2000/10/04 18:09:32 itojun Exp $       */
+/*     $NetBSD: top.c,v 1.4.8.2 2001/04/22 18:36:42 he Exp $   */
 
 char *copyright =
     "Copyright (c) 1984 through 1996, William LeFebvre";
@@ -625,7 +625,8 @@
 
                    /* now read it and convert to command strchr */
                    /* (use "change" as a temporary to hold strchr) */
-                   (void) read(0, &ch, 1);
+                   if (read(0, &ch, 1) < 1)
+                       quit(0);
                    if ((iptr = strchr(command_chars, ch)) == NULL)
                    {
                        /* illegal command */



Home | Main Index | Thread Index | Old Index