diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-02-18 13:39:16 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-02-18 13:39:16 +0100 |
commit | 601e63e757d4cf40d5923cee4b6b3debff57364c (patch) | |
tree | 90d3a5f505508efd67ca33b3c157c59d797bb989 /tex/context/base/mkiv/l-sandbox.lua | |
parent | fcd7cdd22ff42dab791f9f825b642caa3cc63300 (diff) | |
download | context-601e63e757d4cf40d5923cee4b6b3debff57364c.tar.gz |
2017-02-18 11:52:00
Diffstat (limited to 'tex/context/base/mkiv/l-sandbox.lua')
-rw-r--r-- | tex/context/base/mkiv/l-sandbox.lua | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/tex/context/base/mkiv/l-sandbox.lua b/tex/context/base/mkiv/l-sandbox.lua index a95e70395..7a89aa8cd 100644 --- a/tex/context/base/mkiv/l-sandbox.lua +++ b/tex/context/base/mkiv/l-sandbox.lua @@ -166,7 +166,9 @@ function require(name) local n = gsub(name,"^.*[\\/]","") local n = gsub(n,"[%.].*$","") local b = blocked[n] - if b then + if b == false then + return nil -- e.g. ffi + elseif b then if trace then report("using blocked: %s",n) end @@ -183,12 +185,7 @@ function blockrequire(name,lib) if trace then report("preventing reload of: %s",name) end - blocked[name] = lib or _G[name] -end - -if TEXENGINE == "luajittex" or not ffi then - local ok - ok, ffi = pcall(require,"ffi") + blocked[name] = lib or _G[name] or false end function sandbox.enable() @@ -242,31 +239,6 @@ function sandbox.enable() report("not overloaded redefined: %s",concat(skip," | ")) end -- - -- if ffi then - -- report("disabling ffi") - -- -- for k, v in next, ffi do - -- -- if k ~= "gc" then - -- -- local t = type(v) - -- -- if t == "function" then - -- -- ffi[k] = function() report("accessing ffi.%s",k) end - -- -- elseif t == "number" then - -- -- ffi[k] = 0 - -- -- elseif t == "string" then - -- -- ffi[k] = "" - -- -- elseif t == "table" then - -- -- ffi[k] = { } - -- -- else - -- -- ffi[k] = false - -- -- end - -- -- end - -- -- end - -- for k, v in next, ffi do - -- if k ~= "gc" then - -- ffi[k] = nil - -- end - -- end - -- end - -- initializers = nil finalizers = nil originals = nil |