mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-11-01 12:47:16 +00:00
vtysh: Add error code if daemon is not running
After `<daemon_name> is not running` message vtysh does not return error. For example if you disable ospf in `/etc/frr/daemons` and run `vtysh -c configure -c "router ospf"` it prints the message to stderr, but returns 0. This commit will make vtysh return error when not in interractive mode. But if you run commands from vtysh, you will still be able to enter views and exit them if daemon is not running. Signed-off-by: Yaroslav Fedoriachenko <yar.fed99@gmail.com>
This commit is contained in:
parent
f0a4777192
commit
a32f6a107f
@ -229,6 +229,7 @@ struct cmd_node {
|
||||
#define CMD_WARNING_CONFIG_FAILED 13
|
||||
#define CMD_NOT_MY_INSTANCE 14
|
||||
#define CMD_NO_LEVEL_UP 15
|
||||
#define CMD_ERR_NO_DAEMON 16
|
||||
|
||||
/* Argc max counts. */
|
||||
#define CMD_ARGC_MAX 256
|
||||
|
||||
@ -602,7 +602,8 @@ static int vtysh_execute_func(const char *line, int pager)
|
||||
fprintf(stderr,
|
||||
"%s is not running\n",
|
||||
vtysh_client[i].name);
|
||||
continue;
|
||||
cmd_stat = CMD_ERR_NO_DAEMON;
|
||||
break;
|
||||
}
|
||||
}
|
||||
cmd_stat = vtysh_client_execute(
|
||||
@ -611,7 +612,7 @@ static int vtysh_execute_func(const char *line, int pager)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (cmd_stat != CMD_SUCCESS)
|
||||
if (cmd_stat != CMD_SUCCESS && cmd_stat != CMD_ERR_NO_DAEMON)
|
||||
break;
|
||||
|
||||
if (cmd->func)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user