diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-02-09 09:26:58 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-09 09:26:58 -0500 |
| commit | b7671f356aee0ce21e6e006e7b4ee57bd8e00b3d (patch) | |
| tree | 253490726e4fca72b9391e81dbf146b0e005cad2 /lib/vty.c | |
| parent | cf80f28161ec05430723d6fb7bc5928bdc21f825 (diff) | |
| parent | 1520d0aca9acf42faf0433cbe8f66ef9cd97bd0e (diff) | |
Merge pull request #190 from opensourcerouting/config-write-sync-stable
[stable] lib: use fsync() for config writes, plug fd leak
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 (); |
