]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: Print error message when Shell set environment variable fail.
authorQiu Shumin <shumin.qiu@intel.com>
Sat, 10 Oct 2015 01:19:43 +0000 (01:19 +0000)
committershenshushi <shenshushi@Edk2>
Sat, 10 Oct 2015 01:19:43 +0000 (01:19 +0000)
If you try to 'set' a read only environment variable and it fails without printing any information.
This patch add error message printing when 'set' environment variable fails.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18598 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Library/UefiShellLevel2CommandsLib/Set.c
ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni

index 45948e12753111dff3c6fe61512909feb0e8330c..d5e6a089782a5999c5a96acbd5efe02ad9117464 100644 (file)
@@ -2,7 +2,7 @@
   Main file for attrib shell level 2 function.\r
 \r
   (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2015, 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
@@ -141,6 +141,11 @@ ShellCommandRunSet (
         // assigning one\r
         //\r
         Status = ShellSetEnvironmentVariable(KeyName, Value, ShellCommandLineGetFlag(Package, L"-v"));\r
+        if (EFI_ERROR(Status)) {\r
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_ERROR_SET), gShellLevel2HiiHandle, L"set", KeyName);\r
+          ShellStatus = (SHELL_STATUS) (Status & (~MAX_BIT));\r
+        }\r
+        \r
       } else {\r
         if (KeyName != NULL) {\r
           //\r
index 29563d2e21737be3c84a7e3413596a4fc8e0850b..cc2c33cda4a6bf1c4f5dbc8527dfaaab5185ca53 100644 (file)
Binary files a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni and b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni differ