summaryrefslogtreecommitdiffstats
path: root/FatPkg
diff options
context:
space:
mode:
authorOlivier Martin <Olivier.Martin@arm.com>2013-06-14 01:58:12 +0000
committerJordan Justen <jordan.l.justen@intel.com>2016-04-06 23:22:43 -0700
commitab99061ccc218f6a71df049be1228187d7eb7a48 (patch)
treec1f8b5c300e6d78078f6732184487ab1576fe936 /FatPkg
parent4a30cd67a507d0a57a724bbe4d783b58975d0d10 (diff)
downloadedk2-ab99061ccc218f6a71df049be1228187d7eb7a48.tar.gz
edk2-ab99061ccc218f6a71df049be1228187d7eb7a48.tar.bz2
edk2-ab99061ccc218f6a71df049be1228187d7eb7a48.zip
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>
Diffstat (limited to 'FatPkg')
-rw-r--r--FatPkg/EnhancedFatDxe/Misc.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/FatPkg/EnhancedFatDxe/Misc.c b/FatPkg/EnhancedFatDxe/Misc.c
index b62c4c54ae..9a8f3cab4f 100644
--- a/FatPkg/EnhancedFatDxe/Misc.c
+++ b/FatPkg/EnhancedFatDxe/Misc.c
@@ -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