From owner-freebsd-bugs Thu Oct 11 23:30: 6 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id DD17537B408 for ; Thu, 11 Oct 2001 23:30:01 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f9C6U1S20659; Thu, 11 Oct 2001 23:30:01 -0700 (PDT) (envelope-from gnats) Date: Thu, 11 Oct 2001 23:30:01 -0700 (PDT) Message-Id: <200110120630.f9C6U1S20659@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Edwin Groothuis Subject: bin/30581: top(1) races when it loses its terminal Reply-To: Edwin Groothuis Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/30581; it has been noted by GNATS. From: Edwin Groothuis To: freebsd-gnats-submit@FreeBSD.org, pavalos@theshell.com Cc: Subject: bin/30581: top(1) races when it loses its terminal Date: Fri, 12 Oct 2001 16:21:40 +1000 A fix for this is this. I've forward this to the author of top also, can please somebody in the mean time submit this to the FreeBSD source? --- /usr/src/contrib/top/top.c.old Fri Oct 12 16:13:52 2001 +++ /usr/src/contrib/top/top.c Fri Oct 12 16:16:44 2001 @@ -721,7 +721,11 @@ /* 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)==0) { + /* this happens if the controlling terminal */ + /* has disappeared. Maybe due to network problems? */ + quit(0); + } if ((iptr = strchr(command_chars, ch)) == NULL) { if (ch != '\r' && ch != '\n') -- Edwin Groothuis | Personal website: http://www.MavEtJu.org edwin@mavetju.org | Interested in MUDs? Visit Fatal Dimensions: ------------------+ http://www.FatalDimensions.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message