summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiFileHandleLib
diff options
context:
space:
mode:
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2012-02-02 16:55:30 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2012-02-02 16:55:30 +0000
commit74fa83fda6be6277044619276d0f1391e72e54a2 (patch)
tree2201a6eb748778eb6417d52772f4499199c01361 /ShellPkg/Library/UefiFileHandleLib
parent66c44008ba58f74dd88a2c137449d4335c784d40 (diff)
downloadedk2-platforms-74fa83fda6be6277044619276d0f1391e72e54a2.tar.xz
ShellPkg: fix 'ls' handling of empty drives where there is not even an "." or ".." directory.
Signed-off-by: jcarsey Reviewed-by: winddy_zhang@byosoft.com.cn git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12981 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library/UefiFileHandleLib')
-rw-r--r--ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.c b/ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
index 0bee8e3899..fb9d4ec0be 100644
--- a/ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
+++ b/ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
@@ -509,9 +509,12 @@ FileHandleFindFirstFile (
//
Status = FileHandleRead (DirHandle, &BufferSize, *Buffer);
ASSERT(Status != EFI_BUFFER_TOO_SMALL);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR(Status) || BufferSize == 0) {
FreePool(*Buffer);
*Buffer = NULL;
+ if (BufferSize == 0) {
+ return (EFI_NOT_FOUND);
+ }
return (Status);
}
return (EFI_SUCCESS);