Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/absil/bytes.fs
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,11 @@ type ByteMemory with
leaveOpen=false)
mmf, mmf.CreateViewAccessor(0L, length, memoryMappedFileAccess), length

// Validate MMF with the access that was intended.
match access with
| FileAccess.Read when not accessor.CanRead -> failwith "Cannot read file"
| FileAccess.Write when not accessor.CanWrite -> failwith "Cannot write file"
| _ when not accessor.CanRead || not accessor.CanWrite -> failwith "Cannot read or write file"
| FileAccess.Read when not accessor.CanRead -> invalidOp "Cannot read file"
| FileAccess.Write when not accessor.CanWrite -> invalidOp "Cannot write file"
| FileAccess.ReadWrite when not accessor.CanRead || not accessor.CanWrite -> invalidOp "Cannot read or write file"
| _ -> ()

let safeHolder =
Expand Down