/** @file\r
Functions to deal with file buffer.\r
\r
- Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>\r
+ Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved. <BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
// you should set the status string\r
//\r
Status = ReadFileIntoBuffer (FileName, (VOID**)&Buffer, &HFileImage.Size, &HFileImage.ReadOnly);\r
- if (EFI_ERROR(Status) || Buffer == NULL) {\r
- UnicodeBuffer = CatSPrint(NULL, L"Read error on file &s: %r", FileName, Status);\r
+ //\r
+ // NULL pointer is only also a failure for a non-zero file size.\r
+ //\r
+ if ((EFI_ERROR(Status)) || (Buffer == NULL && HFileImage.Size != 0)) {\r
+ UnicodeBuffer = CatSPrint(NULL, L"Read error on file %s: %r", FileName, Status);\r
if (UnicodeBuffer == NULL) {\r
SHELL_FREE_NON_NULL(Buffer);\r
return EFI_OUT_OF_RESOURCES;\r
\r
StatusBarSetStatusString (UnicodeBuffer);\r
FreePool (UnicodeBuffer);\r
+ return EFI_OUT_OF_RESOURCES;\r
}\r
\r
HFileImageSetFileName (FileName);\r