Project

General

Profile

Bug #2938 ยป lighttpd-mod_magnet-fix_wrong_return-type.diff

flynn, 2019-03-06 09:20

View differences:

src/mod_magnet.c 2019-03-06 10:16:59.639029275 +0100
965 965
	/* we should have the function, the lighty table and the return value on the stack */
966 966
	force_assert(lua_gettop(L) == 3);
967 967

  
968
	lua_return_value = (int) luaL_optinteger(L, -1, -1);
968
	{
969
	        int lua_return_type = lua_type(L, -1);
970
		if (lua_return_type == LUA_TNUMBER || lua_return_type == LUA_TNIL) {
971
		        lua_return_value = (int) luaL_optinteger(L, -1, -1);
972
		} else {
973
		        log_error_write(srv, __FILE__, __LINE__, "sss",
974
				"lua_pcall():",
975
				"unexpected return type:", lua_typename(L, lua_return_type));
976
			lua_return_value = -1;
977
		}
978
	}
969 979
	lua_pop(L, 1); /* pop return value */
970 980

  
971 981
	magnet_copy_response_header(con, L, lighty_table_ndx);
    (1-1/1)