diff options
-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;
|