From a0f13ab49fd9e70b1748998b66cd06acfffb4e99 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sun, 19 Jan 2025 18:59:17 +0800 Subject: [PATCH] Move lambda to static function --- native/src/core/zygisk/hook.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/native/src/core/zygisk/hook.cpp b/native/src/core/zygisk/hook.cpp index ea7ef321c..10018f12f 100644 --- a/native/src/core/zygisk/hook.cpp +++ b/native/src/core/zygisk/hook.cpp @@ -216,10 +216,15 @@ DCL_HOOK_FUNC(static int, pthread_attr_destroy, void *target) { // ----------------------------------------------------------------- +static size_t get_fd_max() { + rlimit r{32768, 32768}; + getrlimit(RLIMIT_NOFILE, &r); + return r.rlim_max; +} + ZygiskContext::ZygiskContext(JNIEnv *env, void *args) : env(env), args{args}, process(nullptr), pid(-1), flags(0), info_flags(0), - allowed_fds([] static { rlimit r{32768, 32768}; getrlimit(RLIMIT_NOFILE, &r); return r.rlim_max; }()), - hook_info_lock(PTHREAD_MUTEX_INITIALIZER) { g_ctx = this; } + allowed_fds(get_fd_max()), hook_info_lock(PTHREAD_MUTEX_INITIALIZER) { g_ctx = this; } ZygiskContext::~ZygiskContext() { // This global pointer points to a variable on the stack.