bug in mmap error checking #1138

wgmitchener opened this Issue Aug 8, 2012 · 1 comment


None yet

2 participants


In base/mmap.jl, the system call ccall(:mmap ...) can yield a pointer p that looks like a negative number but is okay. Then the julia function fails incorrectly with strerror giving an error message of "Success" ! According to the linux man page, mmap returns a pointer to -1 if something goes wrong.

I ran into the problem on Fedora 17 on a 32 bit machine. I fixed it by changing base/mmap.jl

if convert(Int,p) < 1
    error("Memory mapping failed", strerror())


if convert(Int,p) == -1
error("Memory mapping failed ", strerror())

Have I missed something here?

@timholy timholy added a commit that closed this issue Aug 8, 2012
@web-flow @timholy web-flow + timholy Fix #1138 81dc5fc
@timholy timholy closed this in 81dc5fc Aug 8, 2012
timholy commented Aug 8, 2012

Thanks for the bug report and fix! I've just pushed this to master. I gave you credit for it, using --author, but in the future don't hesitate to generate a pull request. That way, when it's merged your contributions will automatically be acknowledged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment