]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib/vty: don't clear output buffer on input EOF
authorDavid Lamparter <equinox@opensourcerouting.org>
Thu, 14 May 2015 12:24:06 +0000 (14:24 +0200)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 8 Jun 2016 19:10:54 +0000 (15:10 -0400)
A VTY's input can be closed without the output becoming unavailable.
This happens both on stdio when stdin ends, as well as over TCP when an
unidirectional input shutdown() happens.

In such a case, resetting the output buffer is not appropriate since
there might still be data to be successfully written.

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

index 65bb28bb29b8c107519cb8bdb1b886052aea33a1..504067ee39e6a78075eb9b7c39199f35e36edb09 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -1365,8 +1365,8 @@ vty_read (struct thread *thread)
          vty->monitor = 0; /* disable monitoring to avoid infinite recursion */
          zlog_warn("%s: read error on vty client fd %d, closing: %s",
                    __func__, vty->fd, safe_strerror(errno));
+          buffer_reset(vty->obuf);
        }
-      buffer_reset(vty->obuf);
       vty->status = VTY_CLOSE;
     }