From 71c49eafc54f2f3158ed8861a90cb6eb95e13f97 Mon Sep 17 00:00:00 2001 From: Shumin Qiu Date: Tue, 28 Jan 2014 00:59:46 +0000 Subject: [PATCH] Add initializing code for local variable 'CalleeExitStatus' and 'ExitStatus' in 'Shell.c'. Signed-off-by: Shumin Qiu Reviewed-by: Jaben Carsey git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15191 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Application/Shell/Shell.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c index dc99c5c974..18055d5a85 100644 --- a/ShellPkg/Application/Shell/Shell.c +++ b/ShellPkg/Application/Shell/Shell.c @@ -300,6 +300,12 @@ UefiMain ( // install our console logger. This will keep a log of the output for back-browsing // Status = ConsoleLoggerInstall(ShellInfoObject.LogScreenCount, &ShellInfoObject.ConsoleInfo); + if(EFI_ERROR (Status)) { + ExitStatus = (SHELL_STATUS) (Status & (~MAX_BIT)); + } else { + ExitStatus = SHELL_SUCCESS; + } + if (!EFI_ERROR(Status)) { // // Enable the cursor to be visible @@ -2074,6 +2080,7 @@ RunCommandOrFile( Status = EFI_SUCCESS; CommandWithPath = NULL; DevPath = NULL; + CalleeExitStatus = SHELL_INVALID_PARAMETER; switch (Type) { case Internal_Command: @@ -2149,11 +2156,17 @@ RunCommandOrFile( SHELL_FREE_NON_NULL(DevPath); + if(EFI_ERROR (Status)) { + CalleeExitStatus = (SHELL_STATUS) (Status & (~MAX_BIT)); + } else { + CalleeExitStatus = SHELL_SUCCESS; + } + // // Update last error status. // // Status is an EFI_STATUS. Clear top bit to convert to SHELL_STATUS - SetLastError((SHELL_STATUS) (Status & (~MAX_BIT))); + SetLastError(CalleeExitStatus); break; default: // -- 2.39.5