summaryrefslogtreecommitdiff
path: root/net-p2p/gtk-gnutella/files/gtk-gnutella-1.2.1-glibc234.patch
blob: 8d985b966701404b49cd01296b0e37f8605c5868 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From 31d06cecac572852c6e5e8d85cea641883cbe4c6 Mon Sep 17 00:00:00 2001
From: Raphael Manfredi <ram@entique.fr>
Date: Mon, 9 Aug 2021 09:36:00 +0200
Subject: [PATCH] Fix compilation with newest glibc.

The PTHREAD_STACK_MIN value is no longer a constant but rather
defined as sysconf(_SC_THREAD_STACK_MIN).

Therefore, we must avoid using cpp computations on that value.
---
 src/lib/thread.c | 7 +------
 src/lib/thread.h | 2 +-
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/lib/thread.c b/src/lib/thread.c
index 178c09794..e7a702029 100644
--- a/src/lib/thread.c
+++ b/src/lib/thread.c
@@ -9705,7 +9705,7 @@ thread_launch_trampoline(void *arg)
  * In case PTHREAD_STACK_MIN is not defined by <pthread.h>.
  */
 #ifndef PTHREAD_STACK_MIN
-#define PTHREAD_STACK_MIN 0
+#define PTHREAD_STACK_MIN 1024U
 #endif
 
 /**
@@ -9737,12 +9737,7 @@ thread_launch(struct thread_element *te,
 	pthread_attr_init(&attr);
 
 	if (stack != 0) {
-		/* Avoid compiler warning when PTHREAD_STACK_MIN == 0 */
-#if PTHREAD_STACK_MIN != 0
 		stacksize = MAX(PTHREAD_STACK_MIN, stack);
-#else
-		stacksize = stack;
-#endif
 		stacksize = MAX(stacksize, THREAD_STACK_MIN);
 	} else {
 		stacksize = MAX(THREAD_STACK_DFLT, PTHREAD_STACK_MIN);
diff --git a/src/lib/thread.h b/src/lib/thread.h
index 73e15fa36..740f3a6f9 100644
--- a/src/lib/thread.h
+++ b/src/lib/thread.h
@@ -63,7 +63,7 @@ typedef size_t thread_qid_t;		/* Quasi Thread ID */
 typedef unsigned int thread_key_t;	/* Local thread storage key */
 
 #define THREAD_MAX			64		/**< Max amount of threads we can track */
-#define THREAD_STACK_DFLT	(65536 * PTRSIZE)	/**< Default stack requested */
+#define THREAD_STACK_DFLT	(65536U * PTRSIZE)	/**< Default stack requested */
 #define THREAD_LOCAL_MAX	1024	/**< Max amount of thread-local keys */
 
 #define THREAD_SUSPEND_TIMEOUT	90	/**< secs: thread max suspension time */