summaryrefslogtreecommitdiff
path: root/lib/vty.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vty.c')
-rw-r--r--lib/vty.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/vty.c b/lib/vty.c
index 9594d68ebd..a39fe9f41b 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2330,9 +2330,16 @@ vty_close (struct vty *vty)
/* Unset vector. */
vector_unset (vtyvec, vty->fd);
+ if (vty->wfd > 0 && vty->type == VTY_FILE)
+ fsync (vty->wfd);
+
/* Close socket. */
if (vty->fd > 0)
- close (vty->fd);
+ {
+ close (vty->fd);
+ if (vty->wfd > 0 && vty->wfd != vty->fd)
+ close (vty->wfd);
+ }
else
vty_stdio_reset ();