The following reply was made to PR bin/153052; it has been noted by GNATS.

From: Jilles Tjoelker <[email protected]>
To: [email protected], [email protected]
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");
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to