From owner-svn-src-all@FreeBSD.ORG Fri Sep 13 20:56:42 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id CD838B09; Fri, 13 Sep 2013 20:56:42 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B9187215B; Fri, 13 Sep 2013 20:56:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8DKugMG062402; Fri, 13 Sep 2013 20:56:42 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8DKugOM062401; Fri, 13 Sep 2013 20:56:42 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201309132056.r8DKugOM062401@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 13 Sep 2013 20:56:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255529 - stable/9/usr.sbin/watch X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Sep 2013 20:56:42 -0000 Author: jilles Date: Fri Sep 13 20:56:42 2013 New Revision: 255529 URL: http://svnweb.freebsd.org/changeset/base/255529 Log: MFC r255261: watch: Do not mess up the tty modes on early error. Record the initial state earlier, so it is always safe to restore it. One way this happens is if watch(8) is started by a user that does not have access to /dev/snp. The result is "staircase effect" during later commands. PR: bin/153052 Modified: stable/9/usr.sbin/watch/watch.c Directory Properties: stable/9/usr.sbin/watch/ (props changed) Modified: stable/9/usr.sbin/watch/watch.c ============================================================================== --- stable/9/usr.sbin/watch/watch.c Fri Sep 13 19:55:40 2013 (r255528) +++ stable/9/usr.sbin/watch/watch.c Fri Sep 13 20:56:42 2013 (r255529) @@ -110,7 +110,6 @@ set_tty(void) { struct termios ntty; - tcgetattr(std_in, &otty); ntty = otty; ntty.c_lflag &= ~ICANON; /* disable canonical operation */ ntty.c_lflag &= ~ECHO; @@ -324,6 +323,8 @@ main(int ac, char *av[]) usage(); } + tcgetattr(std_in, &otty); + if (modfind("snp") == -1) if (kldload("snp") == -1 || modfind("snp") == -1) warn("snp module not available");