SemihostFs: Fix check for read-only file or file-open

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14703 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Olivier Martin 2013-09-23 09:41:19 +00:00 committed by oliviermartin
parent d8c4bb9afa
commit cc271ec311
1 changed files with 4 additions and 2 deletions

View File

@ -345,7 +345,8 @@ FileWrite (
Fcb = SEMIHOST_FCB_FROM_THIS(File);
// We cannot write a read-only file
if (Fcb->OpenMode & EFI_FILE_READ_ONLY) {
if ((Fcb->Info.Attribute & EFI_FILE_READ_ONLY)
|| !(Fcb->OpenMode & EFI_FILE_MODE_WRITE)) {
return EFI_ACCESS_DENIED;
}
@ -567,7 +568,8 @@ FileFlush (
if (Fcb->IsRoot) {
return EFI_SUCCESS;
} else {
if (Fcb->Info.Attribute & EFI_FILE_READ_ONLY) {
if ((Fcb->Info.Attribute & EFI_FILE_READ_ONLY)
|| !(Fcb->OpenMode & EFI_FILE_MODE_WRITE)) {
return EFI_ACCESS_DENIED;
} else {
return EFI_SUCCESS;