From 5ff2f40e73da66f7ccdaa68a51c876eca8ba24db Mon Sep 17 00:00:00 2001 From: Qing Huang Date: Tue, 24 Mar 2009 13:56:38 +0000 Subject: [PATCH] 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 Acked-by: Mark Doran Acked-by: Laszlo Ersek --- FatPkg/EnhancedFatDxe/Open.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/FatPkg/EnhancedFatDxe/Open.c b/FatPkg/EnhancedFatDxe/Open.c index b6369cf0b3..ae2aae530d 100644 --- a/FatPkg/EnhancedFatDxe/Open.c +++ b/FatPkg/EnhancedFatDxe/Open.c @@ -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;