Browse Source

bgpd: fix file descriptor leaks in vty_close

In vty_close output file descriptor was not properly closed. It caused
file descriptor leak each time an updated config file was saved on disk.
Evgeny Uskov 3 years ago
parent
commit
084a4ab85d
1 changed files with 4 additions and 0 deletions
  1. 4 0
      lib/vty.c

+ 4 - 0
lib/vty.c

@@ -2365,6 +2365,10 @@ vty_close (struct vty *vty)
   else
     vty_stdio_reset ();
 
+  /* Close output fd (except stdout/stderr) */
+  if (vty->wfd > 2)
+    close (vty->wfd);
+
   if (vty->buf)
     XFREE (MTYPE_VTY, vty->buf);