Nicholas Marriott wrote:
> Why do you need to move tty_close? It is prototyped in tty.h which is
> included at the start of your diff.
> 
> The other changes look good.

You're right. Here's a new diff:


Index: tty.c
===================================================================
RCS file: /cvs/src/bin/ksh/tty.c,v
retrieving revision 1.10
diff -u -p -r1.10 tty.c
--- tty.c       10 Aug 2014 02:44:26 -0000      1.10
+++ tty.c       13 Sep 2015 00:39:45 -0000
@@ -15,19 +15,14 @@ tty_init(int init_ttystate)
        int     do_close = 1;
        int     tfd;
 
-       if (tty_fd >= 0) {
-               close(tty_fd);
-               tty_fd = -1;
-       }
+       tty_close();
        tty_devtty = 1;
 
-       if ((tfd = open("/dev/tty", O_RDWR, 0)) < 0) {
+       tfd = open("/dev/tty", O_RDWR, 0);
+       if (tfd < 0) {
                tty_devtty = 0;
                warningf(false, "No controlling tty (open /dev/tty: %s)",
                    strerror(errno));
-       }
-
-       if (tfd < 0) {
                do_close = 0;
                if (isatty(0))
                        tfd = 0;

Reply via email to