svn commit: r255529 - stable/9/usr.sbin/watch

Jilles Tjoelker jilles at FreeBSD.org
Fri Sep 13 20:56:42 UTC 2013


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");


More information about the svn-src-stable-9 mailing list