summaryrefslogtreecommitdiff
path: root/ShellPkg/Application/Shell/ShellProtocol.c
diff options
context:
space:
mode:
authorChen A Chen <chen.a.chen@intel.com>2016-12-06 13:56:46 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2016-12-09 09:26:28 +0800
commitc5c994c573f3d4044fa5dde01a81ae5ed479d8fe (patch)
tree91a2a34a8466aa2edc2eb92491818260ce882f9a /ShellPkg/Application/Shell/ShellProtocol.c
parent8537bd7ef64f2ccf3b0db515f30813d5c3311a5c (diff)
downloadedk2-platforms-c5c994c573f3d4044fa5dde01a81ae5ed479d8fe.tar.xz
ShellPkg/Application: Fix ">v" cannot update environment variable
When ">v" is used to redirect the command output to environment variable (e.g.: "echo xxx >v yyy"), we only called SetVariable() to update the variable storage but forgot to update the cached environment variables in gShellEnvVarList. When updating the variable storage, the existing code unnecessary saved the ending NULL character into variable storage. The patch fixes all the above issues. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chen A Chen <chen.a.chen@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Tapan Shah <tapandshah@hpe.com>
Diffstat (limited to 'ShellPkg/Application/Shell/ShellProtocol.c')
-rw-r--r--ShellPkg/Application/Shell/ShellProtocol.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c
index 04b66c5aca..12c7c40524 100644
--- a/ShellPkg/Application/Shell/ShellProtocol.c
+++ b/ShellPkg/Application/Shell/ShellProtocol.c
@@ -2872,8 +2872,8 @@ InternalEfiShellSetEnv(
);
if (!EFI_ERROR (Status)) {
Status = Volatile
- ? SHELL_SET_ENVIRONMENT_VARIABLE_V(Name, StrSize(Value), Value)
- : SHELL_SET_ENVIRONMENT_VARIABLE_NV(Name, StrSize(Value), Value);
+ ? SHELL_SET_ENVIRONMENT_VARIABLE_V (Name, StrSize (Value) - sizeof (CHAR16), Value)
+ : SHELL_SET_ENVIRONMENT_VARIABLE_NV (Name, StrSize (Value) - sizeof (CHAR16), Value);
if (EFI_ERROR (Status)) {
ShellRemvoeEnvVarFromList(Name);
}