diff options
author | Olivier Martin <olivier.martin@arm.com> | 2013-09-23 09:41:19 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-09-23 09:41:19 +0000 |
commit | cc271ec31186ebd43ba904451e5a33df33b7f132 (patch) | |
tree | e6a841b567194e50dc2f52973b269dadc5008e07 /ArmPkg/Filesystem/SemihostFs | |
parent | d8c4bb9afa0bd87e4d790f5e8974939bcaea1353 (diff) | |
download | edk2-platforms-cc271ec31186ebd43ba904451e5a33df33b7f132.tar.xz |
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
Diffstat (limited to 'ArmPkg/Filesystem/SemihostFs')
-rw-r--r-- | ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c b/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c index 5f1159d81a..447ab5631a 100644 --- a/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c +++ b/ArmPkg/Filesystem/SemihostFs/Arm/SemihostFs.c @@ -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;
|