From bc0c3d940c9cc9650d6b482461ede384580bd83b Mon Sep 17 00:00:00 2001 From: Ian Butterworth Date: Tue, 3 Sep 2024 22:20:48 -0400 Subject: [PATCH] if non-regular file skip trying to grow since we know that will fail the ftruncate syscall Co-Authored-By: Jameson Nash --- stdlib/Mmap/src/Mmap.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stdlib/Mmap/src/Mmap.jl b/stdlib/Mmap/src/Mmap.jl index e6987582bf511..b45042e055c51 100644 --- a/stdlib/Mmap/src/Mmap.jl +++ b/stdlib/Mmap/src/Mmap.jl @@ -86,6 +86,8 @@ grow!(::Anonymous,o::Integer,l::Integer) = return function grow!(io::IO, offset::Integer, len::Integer) pos = position(io) filelen = filesize(io) + # If non-regular file skip trying to grow since we know that will fail the ftruncate syscall + filelen == 0 && isfile(stat(io)) && return if filelen < offset + len failure = ccall(:jl_ftruncate, Cint, (Cint, Int64), fd(io), offset+len) Base.systemerror(:ftruncate, failure != 0)