From: Vsevolod Stakhov Date: Mon, 8 Oct 2018 16:08:38 +0000 (+0100) Subject: [Minor] Check for cached libevent time routines X-Git-Tag: 1.8.1~70 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=10d67f5c800831b0dd152bf8708237b6b69c9e51;p=thirdparty%2Frspamd.git [Minor] Check for cached libevent time routines --- diff --git a/CMakeLists.txt b/CMakeLists.txt index dbec0ceff3..2d59bd0cc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1078,10 +1078,16 @@ ENDIF(HAVE_SIGINFO_H) # Some hack for libevent 2.0 CHECK_C_SOURCE_COMPILES ("#include - #if _EVENT_NUMERIC_VERSION < 0x02000000 + #if !defined(LIBEVENT_VERSION_NUMBER) || LIBEVENT_VERSION_NUMBER < 0x02000000 #error Unsupported #endif int main() { return 0;}" HAVE_LIBEVENT2) +CHECK_C_SOURCE_COMPILES ("#include + int main() { return EVENT_BASE_FLAG_NO_CACHE_TIME; }" + HAVE_EVENT_NO_CACHE_TIME_FLAG) +LIST(APPEND CMAKE_REQUIRED_LIBRARIES "event") +CHECK_SYMBOL_EXISTS(event_base_update_cache_time "sys/types.h;event.h" + HAVE_EVENT_NO_CACHE_TIME_FUNC) IF(NOT CMAKE_SYSTEM_NAME STREQUAL "SunOS") IF(HAVE_CLOCK_GETTIME) diff --git a/config.h.in b/config.h.in index cb38c87f45..66f287e035 100644 --- a/config.h.in +++ b/config.h.in @@ -42,6 +42,8 @@ #cmakedefine HAVE_IPV6_V6ONLY 1 #cmakedefine HAVE_LIBAIO_H 1 #cmakedefine HAVE_LIBEVENT2 1 +#cmakedefine HAVE_EVENT_NO_CACHE_TIME_FLAG 1 +#cmakedefine HAVE_EVENT_NO_CACHE_TIME_FUNC 1 #cmakedefine HAVE_LIBGEN_H 1 #cmakedefine HAVE_LIBUTIL_H 1 #cmakedefine HAVE_LOCALE_H 1 diff --git a/src/libutil/util.h b/src/libutil/util.h index 8753884322..e97593d215 100644 --- a/src/libutil/util.h +++ b/src/libutil/util.h @@ -11,6 +11,7 @@ #ifdef HAVE_NETDB_H #include #endif + #include #include diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c index 74f446c4f0..65c0609f93 100644 --- a/src/lua/lua_redis.c +++ b/src/lua/lua_redis.c @@ -1006,7 +1006,7 @@ lua_redis_make_request (lua_State *L) lua_pop (L, 1); lua_pushstring (L, "timeout"); - lua_gettable (L, -2); + lua_gettable (L, 1); if (lua_type (L, -1) == LUA_TNUMBER) { timeout = lua_tonumber (L, -1); } @@ -1015,7 +1015,7 @@ lua_redis_make_request (lua_State *L) lua_pushstring (L, "args"); - lua_gettable (L, -2); + lua_gettable (L, 1); lua_redis_parse_args (L, -1, cmd, &sp_ud->args, &sp_ud->arglens, &sp_ud->nargs); lua_pop (L, 1);