代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gazelle 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 6a5bb82feba31762f6c977e618bcee47a5f06d26 Mon Sep 17 00:00:00 2001
From: yanan-rock <yanan@huawei.com>
Date: Sun, 14 May 2023 15:02:58 -0400
Subject: [PATCH] fix previous commit "refactoring preload module"
Signed-off-by: yanan-rock <yanan@huawei.com>
---
src/lstack/core/lstack_init.c | 26 --------------------------
src/lstack/core/lstack_preload.c | 25 ++++++++++++++++++++++++-
2 files changed, 24 insertions(+), 27 deletions(-)
diff --git a/src/lstack/core/lstack_init.c b/src/lstack/core/lstack_init.c
index 53bc541..406a0b8 100644
--- a/src/lstack/core/lstack_init.c
+++ b/src/lstack/core/lstack_init.c
@@ -118,29 +118,6 @@ static int32_t check_process_conflict(void)
return 0;
}
-static int32_t check_preload_bind_proc(void)
-{
- char proc_path[PATH_MAX] = {0};
-
- if (!g_preload_info.preload_switch) {
- return 0;
- }
-
- if (readlink("/proc/self/exe", proc_path, PATH_MAX - 1) <= 0) {
- return -1;
- }
-
- char *proc_name = strrchr(proc_path, '/');
- if (!proc_name) {
- return -1;
- }
-
- if (strncmp(++proc_name, g_preload_info.env_procname, PATH_MAX) == 0) {
- return 0;
- }
- return -1;
-}
-
__attribute__((destructor)) void gazelle_network_exit(void)
{
if (posix_api != NULL && !posix_api->ues_posix) {
@@ -262,9 +239,6 @@ __attribute__((constructor)) void gazelle_network_init(void)
if (preload_info_init() < 0) {
return;
}
- if (check_preload_bind_proc() < 0) {
- return;
- }
/* Read configure from lstack.cfg */
if (cfg_init() != 0) {
diff --git a/src/lstack/core/lstack_preload.c b/src/lstack/core/lstack_preload.c
index 9fc5819..e04f49b 100644
--- a/src/lstack/core/lstack_preload.c
+++ b/src/lstack/core/lstack_preload.c
@@ -26,6 +26,29 @@ struct lstack_preload {
};
static struct lstack_preload g_preload_info = {0};
+static int32_t preload_check_bind_proc(void)
+{
+ char proc_path[PATH_MAX] = {0};
+
+ if (!g_preload_info.preload_switch) {
+ return 0;
+ }
+
+ if (readlink("/proc/self/exe", proc_path, PATH_MAX - 1) <= 0) {
+ return -1;
+ }
+
+ char *proc_name = strrchr(proc_path, '/');
+ if (!proc_name) {
+ return -1;
+ }
+
+ if (strncmp(++proc_name, g_preload_info.env_procname, PATH_MAX) == 0) {
+ return 0;
+ }
+ return -1;
+}
+
static int32_t preload_info_init(void)
{
char *enval = NULL;
@@ -51,5 +74,5 @@ static int32_t preload_info_init(void)
g_preload_info.preload_switch = 1;
LSTACK_PRE_LOG(LSTACK_INFO, "LD_PRELOAD ok\n");
- return 0;
+ return preload_check_bind_proc();
}
--
2.23.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。