From: David Lamparter Date: Thu, 14 May 2015 12:24:06 +0000 (+0200) Subject: lib/vty: don't clear output buffer on input EOF X-Git-Tag: frr-2.0-rc1~560 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=009a4a07ff1f8188c9e3e7ae39f08a0501653af7;p=mirror%2Ffrr.git lib/vty: don't clear output buffer on input EOF 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 --- diff --git a/lib/vty.c b/lib/vty.c index 65bb28bb29..504067ee39 100644 --- 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; }