diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2023-11-16 20:00:07 +0100 | 
|---|---|---|
| committer | Igor Ryzhov <iryzhov@nfware.com> | 2023-11-17 03:16:36 +0100 | 
| commit | 40def43dfa889b43f343498dae0cd196420a4023 (patch) | |
| tree | 497fa5d4b13c7028cd7852e6f26e898aea78ccee /vtysh/vtysh.c | |
| parent | c599ed56fc4c3f8ba16f8dd81bcee5896cea5dc7 (diff) | |
vtysh: clean vtysh_file_locked when exiting config node
The flag should be cleared to make sure it's not reused the next time
we enter the config node.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'vtysh/vtysh.c')
| -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;  | 
