From 88539e4431cd6a596da316f81b644c4df606dbd9 Mon Sep 17 00:00:00 2001 From: Joe Hershberger Date: Fri, 6 Feb 2015 15:37:31 -0600 Subject: sandbox: Return '-c command' exit value as sandbox exit code When a command is passed into sandbox using the '-c' argument the command is run directly. This is most helpful when running tests (such as test-dm.sh). Previously the exit code was an unused enum. Change it to be the actual return code from the command so that the script calling sandbox can know if the command succeeded (tests passed). Also remove the now completely unused "exit_state" in sandbox. Signed-off-by: Joe Hershberger Acked-by: Simon Glass --- arch/sandbox/cpu/start.c | 6 ++++-- arch/sandbox/cpu/state.c | 5 ----- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'arch/sandbox/cpu') diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index 097f29a..ec01040 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -78,11 +78,13 @@ int sandbox_main_loop_init(void) /* Execute command if required */ if (state->cmd) { + int retval; + cli_init(); - run_command_list(state->cmd, -1, 0); + retval = run_command_list(state->cmd, -1, 0); if (!state->interactive) - os_exit(state->exit_type); + os_exit(retval); } return 0; diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c index ba73b7e..033958c 100644 --- a/arch/sandbox/cpu/state.c +++ b/arch/sandbox/cpu/state.c @@ -13,11 +13,6 @@ static struct sandbox_state main_state; static struct sandbox_state *state; /* Pointer to current state record */ -void state_record_exit(enum exit_type_id exit_type) -{ - state->exit_type = exit_type; -} - static int state_ensure_space(int extra_size) { void *blob = state->state_fdt; -- cgit v1.1