]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: fix "-t" command line option
authorDavid Lamparter <equinox@opensourcerouting.org>
Wed, 8 Aug 2018 18:52:15 +0000 (20:52 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Wed, 8 Aug 2018 18:53:27 +0000 (20:53 +0200)
was_stdio was getting set for fd == -1 (config file read), thus
prematurely closing the stdio vty.

Signed-off-by: David Lamparter <equinox@diac24.net>
lib/vty.c

index 073092dfb6470d762fbb44ec2583787c700bbac0..87cae8773ae62ce0140b96ae2bbd395f734325e4 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2303,9 +2303,9 @@ void vty_close(struct vty *vty)
         * additionally, we'd need to replace these fds with /dev/null. */
        if (vty->wfd > STDERR_FILENO && vty->wfd != vty->fd)
                close(vty->wfd);
-       if (vty->fd > STDERR_FILENO) {
+       if (vty->fd > STDERR_FILENO)
                close(vty->fd);
-       } else
+       if (vty->fd == STDIN_FILENO)
                was_stdio = true;
 
        if (vty->buf)