diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-03-07 21:43:00 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-03-07 21:43:00 -0800 |
commit | 2d393bfb80854c8320195b97fecbfe85f62fa9eb (patch) | |
tree | eb9971ec171064fb77efc3ef2a3e910ab5e3a0cb /src/lua.c | |
parent | dd8730920ab6e933b1d7cd226845d749943f649a (diff) | |
download | teliva-2d393bfb80854c8320195b97fecbfe85f62fa9eb.tar.gz |
stop loading libraries after app code
This whole approach of disallowing overriding is suspect.
Diffstat (limited to 'src/lua.c')
-rw-r--r-- | src/lua.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/lua.c b/src/lua.c index 82b995c..2c5e696 100644 --- a/src/lua.c +++ b/src/lua.c @@ -213,7 +213,6 @@ static int pmain (lua_State *L) { globalL = L; if (argv[0] && argv[0][0]) progname = argv[0]; - /* Libraries that can be over-ridden */ lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */ luaL_openlibs(L); status = dorequire(L, "src/lcurses/curses.lua", "curses"); @@ -240,6 +239,8 @@ static int pmain (lua_State *L) { if (status != 0) return 0; status = dorequire(L, "src/task.lua", "task"); if (status != 0) return 0; + status = dorequire(L, "src/file.lua", "file"); + if (status != 0) return 0; lua_gc(L, LUA_GCRESTART, 0); s->status = handle_luainit(L); @@ -247,12 +248,6 @@ static int pmain (lua_State *L) { s->status = load_image(L, argv, 1); if (s->status != 0) return 0; - /* Security-sensitive libraries that cannot be over-ridden */ - /* As a rule of thumb, if we ever special-case any Lua function names in C - * code, that's a signal it needs to load after the app. */ - status = dorequire(L, "src/file.lua", "file"); /* special-cased in io_open */ - if (status != 0) return 0; - /* call main() */ lua_getglobal(L, "spawn_main"); s->status = docall(L, 0, 1); |