From 391206e7754ebe3c32e9d19d7a62ba3bbe43df6a Mon Sep 17 00:00:00 2001 From: jcarsey Date: Thu, 9 May 2013 16:18:58 +0000 Subject: ShellPkg: Update behavior for GetTime() errors. Please find the attached patch that fixes the ShellPkg when gRT->GetTime() returns an error (eg: early UEFI platform bringup with a RTC controller that is not supported). On some platforms, gRT->GetTime() might not return EFI_SUCCESS. The Shell must check the return status before to assume the returned time is valid. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin Reviewed-by: Jaben Carsey git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14337 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Library/UefiShellLevel3CommandsLib/Touch.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ShellPkg/Library/UefiShellLevel3CommandsLib') diff --git a/ShellPkg/Library/UefiShellLevel3CommandsLib/Touch.c b/ShellPkg/Library/UefiShellLevel3CommandsLib/Touch.c index 29f6be3931..f5e27ef1a9 100644 --- a/ShellPkg/Library/UefiShellLevel3CommandsLib/Touch.c +++ b/ShellPkg/Library/UefiShellLevel3CommandsLib/Touch.c @@ -38,7 +38,11 @@ TouchFileByHandle ( return (EFI_ACCESS_DENIED); } Status = gRT->GetTime(&FileInfo->ModificationTime, NULL); - ASSERT_EFI_ERROR(Status); + if (EFI_ERROR(Status)) { + ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"gRT->GetTime", Status); + return (SHELL_DEVICE_ERROR); + } + CopyMem(&FileInfo->LastAccessTime, &FileInfo->ModificationTime, sizeof(EFI_TIME)); Status = gEfiShellProtocol->SetFileInfo(Handle, FileInfo); -- cgit v1.2.3