Date: Sun, 1 Sep 2013 16:00:01 GMT From: Jilles Tjoelker <jilles@stack.nl> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/153052: [patch] watch(8) breaks tty on error Message-ID: <201309011600.r81G01LX068225@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/153052; it has been noted by GNATS. From: Jilles Tjoelker <jilles@stack.nl> To: bug-followup@FreeBSD.org, demelier.david@gmail.com Cc: Subject: Re: bin/153052: [patch] watch(8) breaks tty on error Date: Sun, 1 Sep 2013 17:56:56 +0200 In PR bin/153052, you wrote: > When you run watch and snp module is not loaded (or probably any other > error) watch breaks the terminal > I have removed unset_tty() and seems to work in my case, but I can't > test for the others fatal() calls. Your patch prevents restoring the terminal state if watch(8) is exited using Ctrl+G while watching. I think it is better to record the initial state earlier, so it is always safe to restore it, like this: Index: usr.sbin/watch/watch.c =================================================================== --- usr.sbin/watch/watch.c (revision 255093) +++ usr.sbin/watch/watch.c (working copy) @@ -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");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309011600.r81G01LX068225>