!14 修复编译失败问题

From: @caodongxia
Reviewed-by: @small_leek
Signed-off-by: @small_leek
This commit is contained in:
openeuler-ci-bot 2021-08-10 11:49:40 +00:00 committed by Gitee
commit 984522f0f3
2 changed files with 116 additions and 1 deletions

View File

@ -0,0 +1,111 @@
From b64231e7353a0b2b38cdbde2571d31de88cbcc31 Mon Sep 17 00:00:00 2001
From: caodongxia <315816521@qq.com>
Date: Tue, 10 Aug 2021 11:31:30 +0800
Subject: [PATCH] use default stack size for threads
Refer: https://bugzilla.redhat.com/show_bug.cgi?id=1984808
---
CHANGELOG | 1 +
daemon/automount.c | 29 -----------------------------
daemon/state.c | 6 +-----
lib/alarm.c | 6 +-----
4 files changed, 3 insertions(+), 39 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 63ff767..e83ced2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -33,6 +33,7 @@ xx/xx/2018 autofs-5.1.5
- fix update_negative_cache() map source usage.
- fix program usage message.
- fix use after free in parse_ldap_config().
+- use default stack size for threads
19/12/2017 autofs-5.1.4
- fix spec file url.
diff --git a/daemon/automount.c b/daemon/automount.c
index f0d1f08..b867b06 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -83,7 +83,6 @@ static size_t kpkt_len;
/* Attributes for creating detached and joinable threads */
pthread_attr_t th_attr;
pthread_attr_t th_attr_detached;
-size_t detached_thread_stack_size = PTHREAD_STACK_MIN * 144;
struct master_readmap_cond mrc = {
PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, NULL, 0, 0, 0, 0};
@@ -2491,34 +2490,6 @@ int main(int argc, char *argv[])
exit(1);
}
-#ifdef _POSIX_THREAD_ATTR_STACKSIZE
- if (pthread_attr_setstacksize(
- &th_attr_detached, detached_thread_stack_size)) {
- logerr("%s: failed to set stack size thread attribute!",
- program);
- if (start_pipefd[1] != -1) {
- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
- close(start_pipefd[1]);
- }
- release_flag_file();
- macro_free_global_table();
- exit(1);
- }
-#endif
-
- if (pthread_attr_getstacksize(
- &th_attr_detached, &detached_thread_stack_size)) {
- logerr("%s: failed to get detached thread stack size!",
- program);
- if (start_pipefd[1] != -1) {
- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
- close(start_pipefd[1]);
- }
- release_flag_file();
- macro_free_global_table();
- exit(1);
- }
-
info(logging, "Starting automounter version %s, master map %s",
version, master_list->name);
info(logging, "using kernel protocol version %d.%02d",
diff --git a/daemon/state.c b/daemon/state.c
index 3d91f5b..9db7bf4 100644
--- a/daemon/state.c
+++ b/daemon/state.c
@@ -1215,12 +1215,8 @@ int st_start_handler(void)
status = pthread_attr_init(pattrs);
if (status)
pattrs = NULL;
- else {
+ else
pthread_attr_setdetachstate(pattrs, PTHREAD_CREATE_DETACHED);
-#ifdef _POSIX_THREAD_ATTR_STACKSIZE
- pthread_attr_setstacksize(pattrs, PTHREAD_STACK_MIN*4);
-#endif
- }
status = pthread_create(&thid, pattrs, st_queue_handler, NULL);
diff --git a/lib/alarm.c b/lib/alarm.c
index e6a880b..a32dc73 100755
--- a/lib/alarm.c
+++ b/lib/alarm.c
@@ -219,12 +219,8 @@ int alarm_start_handler(void)
status = pthread_attr_init(pattrs);
if (status)
pattrs = NULL;
- else {
+ else
pthread_attr_setdetachstate(pattrs, PTHREAD_CREATE_DETACHED);
-#ifdef _POSIX_THREAD_ATTR_STACKSIZE
- pthread_attr_setstacksize(pattrs, PTHREAD_STACK_MIN*4);
-#endif
- }
status = pthread_condattr_init(&condattrs);
if (status)
--
2.27.0

View File

@ -1,6 +1,6 @@
Name: autofs
Version: 5.1.4
Release: 27
Release: 28
Epoch: 1
Summary: A tool for automatically mounting and unmounting filesystems
License: GPL-2.0+ and GPL-2.0
@ -42,6 +42,7 @@ Patch0033: 0032-autofs-5.1.4-fix-update_negative_cache-map-source-usage.p
Patch0034: 0033-autofs-5.1.4-fix-program-usage-message.patch
Patch0035: 0034-autofs-5.1.4-fix-use-after-free-in-parse_ldap_config.patch
Patch0036: 0035-fix-automount-aborted-when-use-M.patch
Patch0037: 0036-autofs-5.1.4-use-default-stack-size-for-threads.patch
Requires: bash coreutils sed gawk grep module-init-tools procps
Requires(post): systemd-sysv systemd-units
@ -121,6 +122,9 @@ install -m 600 samples/autofs_ldap_auth.conf $RPM_BUILD_ROOT/etc/autofs_ldap_aut
%{_mandir}/*/*
%changelog
* Tue Aug 10 2021 caodongxia <caodongxia@huawei.com> - 1:5.1.4-28
- Use default stack size for threads
* Mon May 31 2021 baizhonggui <baizhonggui@huawei.com> - 1:5.1.4-27
- Add gcc in BuildRequires