From owner-freebsd-bugs@FreeBSD.ORG Mon Mar 12 22:00:34 2012 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 3033E106564A for ; Mon, 12 Mar 2012 22:00:34 +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 123178FC12 for ; Mon, 12 Mar 2012 22:00:34 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q2CM0X4P082141 for ; Mon, 12 Mar 2012 22:00:33 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q2CM0XuA082140; Mon, 12 Mar 2012 22:00:33 GMT (envelope-from gnats) Date: Mon, 12 Mar 2012 22:00:33 GMT Message-Id: <201203122200.q2CM0XuA082140@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Mark Johnston Cc: Subject: Re: bin/143017: watch(8): fatal: cannot attach to tty X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Mark Johnston List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Mar 2012 22:00:34 -0000 The following reply was made to PR bin/143017; it has been noted by GNATS. From: Mark Johnston To: Ed Schouten Cc: bug-followup@freebsd.org, dummy@smtp.ru Subject: Re: bin/143017: watch(8): fatal: cannot attach to tty Date: Mon, 12 Mar 2012 17:52:36 -0400 On Mon, Mar 12, 2012 at 5:27 PM, Ed Schouten wrote: > Sure, but in that case you can simply use isatty() to distinguish the > special treatment. What I mean is that you can only call watch(8) by > passing the TTY used on the command line. Ok, fair enough. I replaced opt_interactive with isatty(std_out) checks. One check was unnecessary - the line with a FD_ISSET check. I also added a check in unset_tty() so that the terminal doesn't break if we bail with ^C. So the difference now is that in non-interactive mode, we're not interested in stdin, and the tty has to be passed on the command line. > Also I see you've simplified the code that dynamically scales the input > buffer size. Though I think that's a good idea, I do think we should > increase BUF_SIZE to something higher. Setting it to 4 KB or something > shouldn't harm, right? Yeah, good point. I've attached the regenerated patch. -Mark