diff options
author | Chris Hall <chris.hall@highwayman.com> | 2011-03-30 12:22:34 +0100 |
---|---|---|
committer | Chris Hall <chris.hall@highwayman.com> | 2011-03-30 12:22:34 +0100 |
commit | f3255d1e9f062e7783b05ab5b32ca70085170d79 (patch) | |
tree | 2545e94650e88237baf6c0e04758f00e87dc335a /lib/command_execute.c | |
parent | 9c99076cf33bfa874db34151e28822f0e392ab3a (diff) | |
download | quagga-f3255d1e9f062e7783b05ab5b32ca70085170d79.tar.bz2 quagga-f3255d1e9f062e7783b05ab5b32ca70085170d79.tar.xz |
Better mechanism for handling depth_mark in vty->vio.
Previous mechanism required special steps before any new output vty
was opened -- which was easy to forget. New mechanism requires
extra step when input and output are opened at the same time, which
is less common, and more obviously requires the extra step.
Fixes problem with "write memory" command.
Diffstat (limited to 'lib/command_execute.c')
-rw-r--r-- | lib/command_execute.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/command_execute.c b/lib/command_execute.c index 32698d94..cc457ba3 100644 --- a/lib/command_execute.c +++ b/lib/command_execute.c @@ -473,13 +473,13 @@ cmd_open_pipes(vty vty) cmd_parsed parsed = exec->parsed ; cmd_return_code_t ret ; vty_io vio ; - + bool sync_depth ; VTY_LOCK() ; vio = vty->vio ; ret = CMD_SUCCESS ; - uty_cmd_depth_mark(vio) ; /* about to push vin and/or vout */ + sync_depth = false ; /* assuming no in pipe */ /* Deal with any in pipe stuff */ if ((parsed->parts & cmd_part_in_pipe) != 0) @@ -499,6 +499,8 @@ cmd_open_pipes(vty vty) zabort("invalid in pipe state") ; qs_free(args) ; + + sync_depth = true ; } ; /* Deal with any out pipe stuff */ @@ -511,15 +513,18 @@ cmd_open_pipes(vty vty) if ((parsed->out_pipe & cmd_pipe_file) != 0) ret = uty_cmd_open_out_pipe_file(vio, exec->context, args, - parsed->out_pipe) ; + parsed->out_pipe) ; else if ((parsed->out_pipe & cmd_pipe_shell) != 0) ret = uty_cmd_open_out_pipe_shell(vio, exec->context, args, - parsed->out_pipe) ; + parsed->out_pipe) ; else if ((parsed->out_pipe & cmd_pipe_dev_null) != 0) ret = uty_cmd_open_out_dev_null(vio) ; else zabort("invalid out pipe state") ; + if (sync_depth && (ret == CMD_SUCCESS)) + uty_vout_sync_depth(vio) ; + qs_free(args) ; } ; |