From c5c994c573f3d4044fa5dde01a81ae5ed479d8fe Mon Sep 17 00:00:00 2001 From: Chen A Chen Date: Tue, 6 Dec 2016 13:56:46 +0800 Subject: 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 Reviewed-by: Ruiyu Ni Reviewed-by: Jaben Carsey Reviewed-by: Tapan Shah --- ShellPkg/Application/Shell/ShellProtocol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ShellPkg/Application/Shell/ShellProtocol.c') 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); } -- cgit v1.2.3