net.server_select: When an SSL handshake is connected, if there is pending data to...
[prosody.git] / prosody
diff --git a/prosody b/prosody
index 8fcee8e840e45f795f9bd64ed0a22861352c7df4..aab803c5b8c71c16ce616a7b0ccb09ef617f4318 100755 (executable)
--- a/prosody
+++ b/prosody
@@ -153,7 +153,12 @@ function sandbox_require()
        local _real_require = require;
        if not getfenv then
                -- FIXME: This is a hack to replace getfenv() in Lua 5.2
-               function getfenv(f) return debug.getupvalue(debug.getinfo(f or 1).func, 1); end
+               function getfenv(f)
+                       local name, env = debug.getupvalue(debug.getinfo(f or 1).func, 1);
+                       if name == "_ENV" then
+                               return env;
+                       end
+               end
        end
        function require(...)
                local curr_env = getfenv(2);