Fix a spec conformance issue that "Attributes" should only be checked when OpenMode is Create.

(based on FatPkg commit 4a3fecc5dc09ff6da448ffcf57e6a24fbca442f9)

[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>
This commit is contained in:
Qing Huang 2009-03-24 13:56:38 +00:00 committed by Jordan Justen
parent a12324d4fd
commit 5ff2f40e73
1 changed files with 5 additions and 10 deletions

View File

@ -243,19 +243,14 @@ Returns:
default:
return EFI_INVALID_PARAMETER;
}
//
// Check for valid attributes
// Check for valid Attributes for file creation case.
//
if (Attributes & (~EFI_FILE_VALID_ATTR)) {
return EFI_INVALID_PARAMETER;
if (((OpenMode & EFI_FILE_MODE_CREATE) != 0) && (Attributes & (EFI_FILE_READ_ONLY | (~EFI_FILE_VALID_ATTR))) != 0) {
return EFI_INVALID_PARAMETER;
}
//
// Can't open for create and apply the read only attribute
//
if ((OpenMode & EFI_FILE_MODE_CREATE) && (Attributes & EFI_FILE_READ_ONLY)) {
return EFI_INVALID_PARAMETER;
}
IFile = IFILE_FROM_FHAND (FHand);
OFile = IFile->OFile;