]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellLevel3CommandsLib/Pause.c
ShellPkg/Dp: Add null pointer check
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel3CommandsLib / Pause.c
index facacaac7dee6e47868392540244c9b1c4e4d6a9..ab597060e2132d3da43a5a3bf6ad2385c9a88b70 100644 (file)
@@ -1,7 +1,8 @@
 /** @file\r
   Main file for Pause shell level 3 function.\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved. <BR>\r
+  (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
+  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved. <BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -40,6 +41,7 @@ ShellCommandRunPause (
 \r
   ProblemParam        = NULL;\r
   ShellStatus         = SHELL_SUCCESS;\r
+  Resp                = NULL;\r
 \r
   //\r
   // initialize the shell lib (we must be in non-auto-init...)\r
@@ -51,7 +53,7 @@ ShellCommandRunPause (
   ASSERT_EFI_ERROR(Status);\r
 \r
   if (!gEfiShellProtocol->BatchIsActive()) {\r
-    ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_SCRIPT_ONLY), gShellLevel3HiiHandle);\r
+    ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_NO_SCRIPT), gShellLevel3HiiHandle, L"pause");  \r
     return (SHELL_UNSUPPORTED);\r
   }\r
 \r
@@ -61,7 +63,7 @@ ShellCommandRunPause (
   Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);\r
   if (EFI_ERROR(Status)) {\r
     if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, ProblemParam);\r
+      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"pause", ProblemParam);  \r
       FreePool(ProblemParam);\r
       ShellStatus = SHELL_INVALID_PARAMETER;\r
     } else {\r
@@ -74,7 +76,7 @@ ShellCommandRunPause (
     if (ShellCommandLineGetFlag(Package, L"-?")) {\r
       ASSERT(FALSE);\r
     } else if (ShellCommandLineGetRawValue(Package, 1) != NULL) {\r
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle);\r
+      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel3HiiHandle, L"pause");  \r
       ShellStatus = SHELL_INVALID_PARAMETER;\r
     } else {\r
       if (!ShellCommandLineGetFlag(Package, L"-q")) {\r
@@ -82,10 +84,9 @@ ShellCommandRunPause (
       } else {\r
         Status = ShellPromptForResponse(ShellPromptResponseTypeQuitContinue, NULL, (VOID**)&Resp);\r
       }\r
-      ASSERT_EFI_ERROR(Status);\r
 \r
-      if (Resp == NULL || *Resp == ShellPromptResponseQuit) {\r
-        ShellCommandRegisterExit(TRUE);\r
+      if (EFI_ERROR(Status) || Resp == NULL || *Resp == ShellPromptResponseQuit) {\r
+        ShellCommandRegisterExit(TRUE, 0);\r
         ShellStatus = SHELL_ABORTED;\r
       }\r
 \r