]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
fixup! sandbox: table_print prints function signatures instead of pointers
authorVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 10 Apr 2019 11:59:14 +0000 (13:59 +0200)
committerPetr Špaček <petr.spacek@nic.cz>
Wed, 10 Apr 2019 12:23:07 +0000 (14:23 +0200)
daemon/lua/sandbox.lua.in

index 33da8ca96eb821738dc97cf505fb0e6e8c566c94..3d79b661534cc81e3cc6f845a5e50fcbf8a2c938 100644 (file)
@@ -363,12 +363,12 @@ local function funcsign(f)
        pcall(function()
                local oldhook
                local delay = 2
-               local function hook(event, line)
+               local function hook()
                        delay = delay - 1
                        if delay == 0 then  -- call this only for the introspected function
                                for i = 1, math.huge do
                                        -- stack depth 2 is the introspected function
-                                       local k, v = debug.getlocal(2, i)
+                                       local k = debug.getlocal(2, i)
                                        if (k or '('):sub(1, 1) == '(' then
                                                break  -- internal variable, skip
                                        else
@@ -385,8 +385,8 @@ local function funcsign(f)
        end
        oldhook = debug.sethook(hook, "c")  -- invoke hook() on function call
        -- fake arguments, necessary to detect vararg functions
-       fakearg = {}
-       for j = 1, 64 do fakearg[#fakearg + 1] = true end
+       local fakearg = {}
+       for _ = 1, 64 do fakearg[#fakearg + 1] = true end
        f(unpack(fakearg)) -- huh?
        end)
        return "(" .. table.concat(func_args, ", ") .. ")"
@@ -442,6 +442,7 @@ function table_print (tt, indent, done)
                        end
                end
        else  -- not a table
+               local tt_str
                if type(tt) == "function" then
                        tt_str = string.format("function%s\n", funcsign(tt))
                else