diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2017-02-08 16:14:10 +0100 |
---|---|---|
committer | David Lamparter <equinox@opensourcerouting.org> | 2017-02-09 14:25:55 +0100 |
commit | 1520d0aca9acf42faf0433cbe8f66ef9cd97bd0e (patch) | |
tree | 253490726e4fca72b9391e81dbf146b0e005cad2 /lib/vty.c | |
parent | Merge pull request #179 from donaldsharp/more_quagga_fixups (diff) | |
download | frr-1520d0aca9acf42faf0433cbe8f66ef9cd97bd0e.tar.xz frr-1520d0aca9acf42faf0433cbe8f66ef9cd97bd0e.zip |
lib: use fsync() for config writes, plug fd leak
sync() has a HUGE impact on systems that perform actual I/O, i.e. real
servers...
Also, we were leaking a fd on each config write ever since
c5e69a0 "lib/vty: add separate output fd support to VTYs"
(by myself :( ...)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/vty.c')
-rw-r--r-- | lib/vty.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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 (); |