Revision: 19392
          http://sourceforge.net/p/edk2/code/19392
Author:   vanjeff
Date:     2015-12-18 07:27:50 +0000 (Fri, 18 Dec 2015)
Log Message:
-----------
ShellPkg: Print error message when Shell set environment variable fail.

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.

(Sync patch r18598 from main trunk.)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/18598

Modified Paths:
--------------
    branches/UDK2015/ShellPkg/Library/UefiShellLevel2CommandsLib/Set.c
    
branches/UDK2015/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni

Modified: branches/UDK2015/ShellPkg/Library/UefiShellLevel2CommandsLib/Set.c
===================================================================
--- branches/UDK2015/ShellPkg/Library/UefiShellLevel2CommandsLib/Set.c  
2015-12-18 07:27:10 UTC (rev 19391)
+++ branches/UDK2015/ShellPkg/Library/UefiShellLevel2CommandsLib/Set.c  
2015-12-18 07:27:50 UTC (rev 19392)
@@ -2,7 +2,7 @@
   Main file for attrib shell level 2 function.
 
   (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -141,6 +141,11 @@
         // assigning one
         //
         Status = ShellSetEnvironmentVariable(KeyName, Value, 
ShellCommandLineGetFlag(Package, L"-v"));
+        if (EFI_ERROR(Status)) {
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_ERROR_SET), 
gShellLevel2HiiHandle, L"set", KeyName);
+          ShellStatus = (SHELL_STATUS) (Status & (~MAX_BIT));
+        }
+        
       } else {
         if (KeyName != NULL) {
           //

Modified: 
branches/UDK2015/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni
===================================================================
--- 
branches/UDK2015/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni
 2015-12-18 07:27:10 UTC (rev 19391)
+++ 
branches/UDK2015/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni
 2015-12-18 07:27:50 UTC (rev 19392)
@@ -4,7 +4,7 @@
  - @@ -128,6 +128,8 @@
  +  

------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to