diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-02-09 09:52:58 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-09 09:52:58 -0500 |
| commit | b9aa3abbbebb7db75f7209938074aa0cac6d377d (patch) | |
| tree | 77461b93bf06d698f91fc98d5ba4f89979dc06f9 /lib/vty.c | |
| parent | 9c3a235e8a8bbfc0c4465bb26bf36981bd387899 (diff) | |
| parent | 056cfe496e84eed72c4d2226a7a405e5263cdc7a (diff) | |
Merge pull request #189 from opensourcerouting/config-write-sync
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
@@ -2254,9 +2254,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 was_stdio = true; |
