mirror of https://github.com/acidanthera/audk.git
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:
parent
d8c4bb9afa
commit
cc271ec311
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue