diff options
| author | Donald Sharp <donaldsharp72@gmail.com> | 2023-11-20 15:18:42 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-20 15:18:42 -0500 |
| commit | 83cbdcc2670682db1e6c631e532ec42f05a57d46 (patch) | |
| tree | 71b6423d408dbc808c06737f63f22d00944d7554 | |
| parent | 9ec7aa95f57f497f8368ae4356e2bbafc4b6404d (diff) | |
| parent | 40def43dfa889b43f343498dae0cd196420a4023 (diff) | |
Merge pull request #14813 from idryzhov/vtysh-file-lock
vtysh: clean vtysh_file_locked when exiting config node
| -rw-r--r-- | vtysh/vtysh.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index bd283803fe..e87a69d821 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1652,6 +1652,7 @@ static int vtysh_end(void) /* Nothing to do. */ break; default: + vty->vtysh_file_locked = false; vty->node = ENABLE_NODE; break; } @@ -2396,14 +2397,18 @@ static int vtysh_exit(struct vty *vty) vty->node = cnode->parent_node; if (vty->node == CONFIG_NODE) { + bool locked = vty->vtysh_file_locked; + /* resync in case one of the daemons is somewhere else */ vtysh_execute("end"); /* NOTE: a rather expensive thing to do, can we avoid it? */ - if (vty->vtysh_file_locked) + if (locked) vtysh_execute("configure terminal file-lock"); else vtysh_execute("configure terminal"); + } else if (vty->node == ENABLE_NODE) { + vty->vtysh_file_locked = false; } return CMD_SUCCESS; |
