Please find this patch that makes FatGetCurrentFatTime() always return a valid time. Without this patch if gRT->GetTime fails to return the time then some operations on the filesystem could fail.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <Olivier.Martin@arm.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

(based on FatPkg commit c9429aef66663a27642bdaa3685e8a86f7bc74c7)

[jordan.l.justen@intel.com: Use script to relicense to 2-clause BSD]
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Leif Lindholm <leif.lindholm@arm.com>
This commit is contained in:
Olivier Martin 2013-06-14 01:58:12 +00:00 committed by Jordan Justen
parent 4a30cd67a5
commit ab99061ccc
1 changed files with 13 additions and 3 deletions

View File

@ -342,9 +342,19 @@ Returns:
--*/
{
EFI_TIME Now;
gRT->GetTime (&Now, NULL);
FatEfiTimeToFatTime (&Now, FatNow);
EFI_STATUS Status;
EFI_TIME Now;
Status = gRT->GetTime (&Now, NULL);
if (!EFI_ERROR (Status)) {
FatEfiTimeToFatTime (&Now, FatNow);
} else {
ZeroMem (&Now, sizeof (EFI_TIME));
Now.Year = 1980;
Now.Month = 1;
Now.Day = 1;
FatEfiTimeToFatTime (&Now, FatNow);
}
}
BOOLEAN