Reviewed-by: Jaben Carsey <[email protected]>

> -----Original Message-----
> From: Marvin Häuser [mailto:[email protected]]
> Sent: Saturday, May 05, 2018 5:07 PM
> To: [email protected]
> Cc: Carsey, Jaben <[email protected]>; Ni, Ruiyu <[email protected]>
> Subject: [PATCH] ShellPkg/UefiShellCommandLib: Do not error-exit when
> PlatformLang is missing.
> Importance: High
> 
> Currently, when the PlatformLang variable is missing,
> UefiShellCommandLib error-exits. To prevent the entire UEFI Shell
> from failing to load over a missing variable, "en-US" is assumed when
> the variable location fails.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Marvin Haeuser <[email protected]>
> ---
>  ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c | 9 ++++----
> -
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> index 0df252b42036..dfcfd2e0dd54 100644
> --- a/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> +++ b/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
> @@ -81,9 +81,6 @@ CommandInit(
>    CHAR8                           *PlatformLang;
> 
>    GetEfiGlobalVariable2 (EFI_PLATFORM_LANG_VARIABLE_NAME,
> (VOID**)&PlatformLang, NULL);
> -  if (PlatformLang == NULL) {
> -    return EFI_UNSUPPORTED;
> -  }
> 
>    if (gUnicodeCollation == NULL) {
>      Status = gBS->LocateHandleBuffer (
> @@ -120,7 +117,7 @@ CommandInit(
>        BestLanguage = GetBestLanguage (
>                         Uc->SupportedLanguages,
>                         FALSE,
> -                       PlatformLang,
> +                       ((PlatformLang != NULL) ? PlatformLang : "en-US"),
>                         NULL
>                         );
>        if (BestLanguage != NULL) {
> @@ -132,7 +129,9 @@ CommandInit(
>      if (Handles != NULL) {
>        FreePool (Handles);
>      }
> -    FreePool (PlatformLang);
> +    if (PlatformLang != NULL) {
> +      FreePool (PlatformLang);
> +    }
>    }
> 
>    return (gUnicodeCollation == NULL) ? EFI_UNSUPPORTED : EFI_SUCCESS;
> --
> 2.17.0.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to