Skip to content

Commit

Permalink
catch edge case on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasIsensee committed Sep 19, 2024
1 parent 8cc1c73 commit 44c82bd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/bufferedio.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function BufferedWriter(io, buffer_size::Integer = 0; extensible::Bool=false)
pos = position(io)
skip(io, buffer_size)
buf = Vector{UInt8}(undef, buffer_size)
BufferedWriter(io, buf, pos, Ptr{Nothing}(pointer(buf)), extensible)
BufferedWriter(io, buf, Int64(pos), Ptr{Nothing}(pointer(buf)), extensible)
end
Base.show(io::IO, ::BufferedWriter) = print(io, "BufferedWriter")

Expand Down
2 changes: 2 additions & 0 deletions src/mmapio.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ if Sys.isunix()
offset_page::Int64 = div(offset, Mmap.PAGESIZE) * Mmap.PAGESIZE
# add (offset - offset_page) to `len` to get total length of memory-mapped region
mmaplen::Int64 = (offset - offset_page) + len
# Edge case: calling msync with 0 mmaplen fails on mac
mmaplen == 0 && return nothing
systemerror("msync",
ccall(:msync, Cint, (Ptr{Cvoid}, Csize_t, Cint),
io.startptr + offset_page, mmaplen,
Expand Down

0 comments on commit 44c82bd

Please sign in to comment.