components/lighttpd/patches/fix_lua.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Mon, 01 Apr 2013 23:00:57 -0700
changeset 1243 cf247f5101ae
parent 1028 30d7999e80d9
permissions -rw-r--r--
Added tag s12-19 for changeset f52d88cf6f9e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1028
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     1
--- src/mod_cml_lua.c.orig	2012-10-22 06:17:17.418886286 -0700
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     2
+++ src/mod_cml_lua.c	2012-10-22 06:25:50.289753316 -0700
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     3
@@ -33,6 +33,10 @@
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     4
 #include <lualib.h>
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     5
 #include <lauxlib.h>
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     6
 
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     7
+#if LUA_VERSION_NUM >= 502
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     8
+#define LUA_GLOBALSINDEX LUA_REGISTRYINDEX
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
     9
+#endif
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    10
+
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    11
 typedef struct {
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    12
 	stream st;
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    13
 	int done;
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    14
@@ -290,7 +294,11 @@
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    15
 	lua_settable(L, LUA_GLOBALSINDEX);
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    16
 
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    17
 	/* load lua program */
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    18
+#if LUA_VERSION_NUM >= 502
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    19
+	if (lua_load(L, load_file, &rm, fn->ptr, NULL) || lua_pcall(L,0,1,0)) {
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    20
+#else
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    21
 	if (lua_load(L, load_file, &rm, fn->ptr) || lua_pcall(L,0,1,0)) {
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    22
+#endif
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    23
 		log_error_write(srv, __FILE__, __LINE__, "s",
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    24
 				lua_tostring(L,-1));
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    25
 
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    26
--- src/mod_magnet.c.orig	2012-10-22 06:17:24.314956607 -0700
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    27
+++ src/mod_magnet.c	2012-10-22 06:19:25.001600796 -0700
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    28
@@ -785,7 +785,11 @@
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    29
 	lua_setfield(L, -2, "lighty"); /* lighty.*                   (sp -= 1) */
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    30
 
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    31
 	lua_newtable(L); /* the meta-table for the new env           (sp += 1) */
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    32
+#if LUA_VERSION_NUM >= 502
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    33
+	lua_pushvalue(L, LUA_REGISTRYINDEX);                      /* (sp += 1) */
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    34
+#else
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    35
 	lua_pushvalue(L, LUA_GLOBALSINDEX);                       /* (sp += 1) */
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    36
+#endif
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    37
 	lua_setfield(L, -2, "__index"); /* { __index = _G }          (sp -= 1) */
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    38
 	lua_setmetatable(L, -2); /* setmetatable({}, {__index = _G}) (sp -= 1) */
30d7999e80d9 7203970 lua update breaks things
Rich Burridge <rich.burridge@oracle.com>
parents:
diff changeset
    39