]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg/alias: Return status for alias deletion
authorRuiyu Ni <ruiyu.ni@intel.com>
Tue, 6 Jun 2017 05:26:12 +0000 (13:26 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Wed, 7 Jun 2017 00:51:41 +0000 (08:51 +0800)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c

index 5a3b7e5913f133d2b992cf9a077b7f7ca0130a45..7277bd4b90dcbc2d87cb2cd4ed70489d70cb8a2f 100644 (file)
@@ -2,7 +2,7 @@
   Main file for Alias shell level 3 function.\r
 \r
   (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
   Main file for Alias shell level 3 function.\r
 \r
   (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved. <BR>\r
+  Copyright (c) 2009 - 2017, 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
   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
@@ -151,6 +151,15 @@ ShellCommandRunAlias (
       // delete an alias\r
       //\r
       Status = gEfiShellProtocol->SetAlias(Param1, NULL, TRUE, FALSE);\r
       // delete an alias\r
       //\r
       Status = gEfiShellProtocol->SetAlias(Param1, NULL, TRUE, FALSE);\r
+      if (EFI_ERROR(Status)) {\r
+        if (Status == EFI_ACCESS_DENIED) {\r
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellLevel3HiiHandle, L"alias");  \r
+          ShellStatus = SHELL_ACCESS_DENIED;\r
+        } else {\r
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel3HiiHandle, L"alias", Status);  \r
+          ShellStatus = SHELL_DEVICE_ERROR;\r
+        }\r
+      }\r
     } else if (ShellCommandLineGetCount(Package) == 3) {\r
       //\r
       // must be adding an alias\r
     } else if (ShellCommandLineGetCount(Package) == 3) {\r
       //\r
       // must be adding an alias\r