Skip to content

Commit

Permalink
lib/vty: don't print to closed vty
Browse files Browse the repository at this point in the history
vty_config_exit() may be called when the vty is already mostly gone,
i.e. when we lost a connection or pipe.  Drop the warnings in that case,
they won't make it anywhere.

Signed-off-by: David Lamparter <equinox@diac24.net>
  • Loading branch information
eqvinox committed Apr 15, 2020
1 parent 0b10050 commit b715007
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -2615,8 +2615,9 @@ void vty_config_exit(struct vty *vty)
node = cnode->parent_node;
}
if (node != CONFIG_NODE) {
vty_out(vty,
"WARNING: vty_config_exit() from outside CONFIG_NODE!\n");
if (vty->status != VTY_CLOSE)
vty_out(vty,
"WARNING: vty_config_exit() from outside CONFIG_NODE!\n");
return;
}

Expand All @@ -2628,8 +2629,9 @@ void vty_config_exit(struct vty *vty)

/* Check if there's a pending confirmed commit. */
if (vty->t_confirmed_commit_timeout) {
vty_out(vty,
"WARNING: exiting with a pending confirmed commit. Rolling back to previous configuration.\n\n");
if (vty->status != VTY_CLOSE)
vty_out(vty,
"WARNING: exiting with a pending confirmed commit. Rolling back to previous configuration.\n\n");
nb_cli_confirmed_commit_rollback(vty);
nb_cli_confirmed_commit_clean(vty);
}
Expand Down

0 comments on commit b715007

Please sign in to comment.