The problem is, apparently fopen succeeds when trying to open a
directory but later on, when the file is actually fread from, this
error happens. I changed 'readable' so that it will fail if reading
from the file fails:
That should work in modern Unix systems. luaL_loadfile has similar code.
In old Unix systems, directories could be read like ordinary files.
(Ah, the good old days...)
yeah.