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
This commit is contained in:
jcarsey
2012-02-02 16:55:30 +00:00
parent 66c44008ba
commit 74fa83fda6
3 changed files with 14 additions and 3 deletions

View File

@@ -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);