From: "Marvin Häuser" <Marvin.Haeuser@outlook.com>
To: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "jaben.carsey@intel.com" <jaben.carsey@intel.com>,
"ruiyu.ni@intel.com" <ruiyu.ni@intel.com>
Subject: [PATCH] ShellPkg/UefiShellCommandLib: Do not error-exit when PlatformLang is missing.
Date: Sun, 6 May 2018 00:07:17 +0000 [thread overview]
Message-ID: <VI1PR0801MB1790A89071C6BB3501F3109680840@VI1PR0801MB1790.eurprd08.prod.outlook.com> (raw)
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 <Marvin.Haeuser@outlook.com>
---
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
next reply other threads:[~2018-05-06 0:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-06 0:07 Marvin Häuser [this message]
2018-05-07 18:10 ` [PATCH] ShellPkg/UefiShellCommandLib: Do not error-exit when PlatformLang is missing Carsey, Jaben
2018-05-17 8:00 ` Ni, Ruiyu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=VI1PR0801MB1790A89071C6BB3501F3109680840@VI1PR0801MB1790.eurprd08.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox