1 Star 0 Fork 40

tmacbb/haproxy

forked from src-openEuler/haproxy 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-thread-add-a-check-for-pthread_create.patch 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
xh 提交于 2023-09-27 11:28 +08:00 . backport to fix potential coredump
From ef667b1ad89bb159b1991de0ec07d17e4320df23 Mon Sep 17 00:00:00 2001
From: eaglegai <eaglegai@163.com>
Date: Fri, 26 May 2023 16:44:34 +0800
Subject: [PATCH] BUG/MINOR: thread: add a check for pthread_create
preload_libgcc_s() use pthread_create to create a thread and then call
pthread_join to use it, but it doesn't check if the option is successful.
So add a check to aviod potential crash.
Conflict:NA
Reference:https://github.com/haproxy/haproxy/commit/ef667b1ad89bb159b1991de0ec07d17e4320df23
---
src/thread.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/thread.c b/src/thread.c
index d7128252ed0e..b41b6628a4cb 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -1066,8 +1066,8 @@ static void *dummy_thread_function(void *data)
static inline void preload_libgcc_s(void)
{
pthread_t dummy_thread;
- pthread_create(&dummy_thread, NULL, dummy_thread_function, NULL);
- pthread_join(dummy_thread, NULL);
+ if (pthread_create(&dummy_thread, NULL, dummy_thread_function, NULL) == 0)
+ pthread_join(dummy_thread, NULL);
}
static void __thread_init(void)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tmacbb/haproxy.git
git@gitee.com:tmacbb/haproxy.git
tmacbb
haproxy
haproxy
master

搜索帮助