summaryrefslogtreecommitdiffstats
path: root/FatPkg
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2013-03-12 01:51:42 +0000
committerJordan Justen <jordan.l.justen@intel.com>2016-04-06 23:22:43 -0700
commit3ba5368df0a3d459606fe78bc73776359c8bc005 (patch)
tree403bb7a9ef4bf5b6f368379fa87cc07eb1f53c96 /FatPkg
parentf4500fc17952c367d21d89defa9cd72b956e6637 (diff)
downloadedk2-3ba5368df0a3d459606fe78bc73776359c8bc005.tar.gz
edk2-3ba5368df0a3d459606fe78bc73776359c8bc005.tar.bz2
edk2-3ba5368df0a3d459606fe78bc73776359c8bc005.zip
1. Expand and add null terminate to end of string like function comments said in EngFatToStr(), it could fix the randomly failure during recovery to find the correct recovery image for name length = 8.3 case. 2. Skip directory entry with FAT_ATTR_DIRECTORY, not just = FAT_ATTR_DIRECTORY in FatReadNextDirectoryEntry().
Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> (based on FatPkg commit 1cc9454c1223e8177ba3028bdf3fa72b52aacffe) [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: Mark Doran <mark.doran@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'FatPkg')
-rw-r--r--FatPkg/FatPei/FatLiteAccess.c4
-rw-r--r--FatPkg/FatPei/FatLiteLib.c11
2 files changed, 8 insertions, 7 deletions
diff --git a/FatPkg/FatPei/FatLiteAccess.c b/FatPkg/FatPei/FatLiteAccess.c
index 53f5e3f60c..110634508b 100644
--- a/FatPkg/FatPei/FatLiteAccess.c
+++ b/FatPkg/FatPei/FatLiteAccess.c
@@ -1,7 +1,7 @@
/** @file
FAT file system access routines for FAT recovery PEIM
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
@@ -475,7 +475,7 @@ FatReadNextDirectoryEntry (
// We only search for *FILE* in root directory
// Long file name entry is *NOT* supported
//
- if ((DirEntry.Attributes == FAT_ATTR_DIRECTORY) || (DirEntry.Attributes == FAT_ATTR_LFN)) {
+ if (((DirEntry.Attributes & FAT_ATTR_DIRECTORY) == FAT_ATTR_DIRECTORY) || (DirEntry.Attributes == FAT_ATTR_LFN)) {
continue;
}
//
diff --git a/FatPkg/FatPei/FatLiteLib.c b/FatPkg/FatPei/FatLiteLib.c
index b5191b6706..06f031defe 100644
--- a/FatPkg/FatPei/FatLiteLib.c
+++ b/FatPkg/FatPei/FatLiteLib.c
@@ -1,7 +1,7 @@
/** @file
General purpose supporting routines for FAT recovery PEIM
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
@@ -317,15 +317,16 @@ EngFatToStr (
// No DBCS issues, just expand and add null terminate to end of string
//
while (*Fat != 0 && FatSize != 0) {
+ if (*Fat == ' ') {
+ break;
+ }
*String = *Fat;
String += 1;
Fat += 1;
FatSize -= 1;
- if (*Fat == ' ') {
- *String = 0;
- return ;
- }
}
+
+ *String = 0;
}