Date: Thu, 11 Oct 2001 23:30:01 -0700 (PDT) From: Edwin Groothuis <edwin@mavetju.org> To: freebsd-bugs@FreeBSD.org Subject: bin/30581: top(1) races when it loses its terminal Message-ID: <200110120630.f9C6U1S20659@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/30581; it has been noted by GNATS. From: Edwin Groothuis <edwin@mavetju.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200110120630.f9C6U1S20659>