diff options
author | Benoit Giannangeli <giann008@gmail.com> | 2017-05-28 13:47:18 +0200 |
---|---|---|
committer | Benoit Giannangeli <giann008@gmail.com> | 2017-05-28 13:47:18 +0200 |
commit | c64a3e7596b9e29c58a0a7cdd6574a837e0395e5 (patch) | |
tree | e4e6a0bc992830404317db3b86fd6b34897bd561 /src/lauxlib.js | |
parent | 03fa39649de945d5a392f460fd592f815534f69a (diff) | |
download | fengari-c64a3e7596b9e29c58a0a7cdd6574a837e0395e5.tar.gz fengari-c64a3e7596b9e29c58a0a7cdd6574a837e0395e5.tar.bz2 fengari-c64a3e7596b9e29c58a0a7cdd6574a837e0395e5.zip |
luaL_loadfilex raise error if filename is not a file
e.g. a directory
Diffstat (limited to 'src/lauxlib.js')
-rw-r--r-- | src/lauxlib.js | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js index 3851ee7..c6a975c 100644 --- a/src/lauxlib.js +++ b/src/lauxlib.js @@ -745,6 +745,8 @@ if (!WEB) { lua.lua_pushliteral(L, `@${jsfilename}`); try { lf.f = fs.openSync(jsfilename, "r"); + if (!fs.fstatSync(lf.f).isFile()) + throw new Error(`${jsfilename} is not a readable file`); } catch (e) { return errfile(L, "open", fnameindex, e); } |