ShellPkg/setvar: Check the duplicate flag

Signed-off-by: Huajing Li <huajing.li@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
This commit is contained in:
Huajing Li 2017-07-27 12:33:43 +08:00 committed by Ruiyu Ni
parent 2c2c68b9d3
commit 1557f05b37
2 changed files with 5 additions and 0 deletions

View File

@ -384,6 +384,10 @@ ShellCommandRunSetVar (
} else {
ASSERT(FALSE);
}
} else if (ShellCommandLineCheckDuplicate (Package,&ProblemParam) != EFI_SUCCESS) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DUPLICATE), gShellDebug1HiiHandle, L"setvar", ProblemParam);
FreePool(ProblemParam);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
if (ShellCommandLineGetCount(Package) < 2) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle, L"setvar");

View File

@ -32,6 +32,7 @@
#string STR_GEN_PROBLEM #language en-US "%H%s%N: Unknown flag - '%H%s%N'\r\n"
#string STR_GEN_PROBLEM_VAL #language en-US "%H%s%N: Bad value - '%H%s%N' for flag - '%H%s%N'\r\n"
#string STR_GEN_DUPLICATE #language en-US "%H%s%N: Duplicate flag - '%H%s%N'\r\n"
#string STR_GEN_NO_VALUE #language en-US "%H%s%N: Missing argument for flag - '%H%s%N'\r\n"
#string STR_GEN_TOO_FEW #language en-US "%H%s%N: Too few arguments.\r\n"
#string STR_GEN_TOO_MANY #language en-US "%H%s%N: Too many arguments.\r\n"