logging/vty: fix: do not close stderr in vty_close()

Since Icdeaea67a06da3a2f07b252e455629559ecc1829, we use stderr for
printing warnings while parsing the VTY configuration files. Make
sure we do not close() stderr. Otherwise stderr logging gets broken.

Change-Id: I6ecc85555d102f5911d50ed5ac54933c766fa84d
Fixes: Icdeaea67a06da3a2f07b252e455629559ecc1829
This commit is contained in:
Vadim Yanitskiy 2019-11-21 16:22:12 +07:00
parent b639b4d4f7
commit 02f25ea77b
1 changed files with 1 additions and 1 deletions

View File

@ -231,7 +231,7 @@ void vty_close(struct vty *vty)
vector_unset(vtyvec, vty->fd);
/* Close socket. */
if (vty->fd > 0) {
if (vty->fd > 0 && vty->fd != fileno(stderr)) {
close(vty->fd);
vty->fd = -1;
}