Skip to content

Commit

Permalink
Update stdlib/Mmap/src/Mmap.jl
Browse files Browse the repository at this point in the history
Co-authored-by: Jameson Nash <[email protected]>
  • Loading branch information
xgdgsc and vtjnash committed Nov 8, 2022
1 parent 817a8ee commit 434ba18
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion stdlib/Mmap/src/Mmap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ function mmap(io::IO,
@static if Sys.isunix()
prot, flags, iswrite = settings(file_desc, shared)
iswrite && grow && grow!(io, offset, len)
!iswrite && mmaplen > filesize(io) && throw(ArgumentError("unable to mmap file size smaller than $mmaplen due to read-only permissions. Please check your dims"))
szfile = convert(Csize_t, len + offset)
!iswrite && szfile > filesize(io) && throw(ArgumentError("unable to increase file size to $szfile due to read-only permissions"))
# mmap the file
ptr = ccall(:jl_mmap, Ptr{Cvoid}, (Ptr{Cvoid}, Csize_t, Cint, Cint, RawFD, Int64),
C_NULL, mmaplen, prot, flags, file_desc, offset_page)
Expand Down

0 comments on commit 434ba18

Please sign in to comment.