Blame SOURCES/0021-libmultipath-deal-with-dynamic-PTHREAD_STACK_MIN.patch

68b27c
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
68b27c
From: Benjamin Marzinski <bmarzins@redhat.com>
68b27c
Date: Thu, 29 Jul 2021 13:16:57 -0500
68b27c
Subject: [PATCH] libmultipath: deal with dynamic PTHREAD_STACK_MIN
68b27c
68b27c
Starting in glibc-2.34 (commit 5d98a7da), PTHREAD_STACK_MIN is defined
68b27c
as sysconf(_SC_THREAD_STACK_MIN) if _GNU_SOURCE is defined. sysconf()
68b27c
returns a long and can, at least in theory, return -1.  This change
68b27c
causes compilation to fail in setup_thread_attr() due to a comparision
68b27c
with different signedness, since stacksize is a size_t.
68b27c
68b27c
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
68b27c
---
68b27c
 libmultipath/util.c | 4 ++--
68b27c
 1 file changed, 2 insertions(+), 2 deletions(-)
68b27c
68b27c
diff --git a/libmultipath/util.c b/libmultipath/util.c
68b27c
index 0e37f3ff..17f8fcc6 100644
68b27c
--- a/libmultipath/util.c
68b27c
+++ b/libmultipath/util.c
68b27c
@@ -223,8 +223,8 @@ setup_thread_attr(pthread_attr_t *attr, size_t stacksize, int detached)
68b27c
 
68b27c
 	ret = pthread_attr_init(attr);
68b27c
 	assert(ret == 0);
68b27c
-	if (stacksize < PTHREAD_STACK_MIN)
68b27c
-		stacksize = PTHREAD_STACK_MIN;
68b27c
+	if (PTHREAD_STACK_MIN > 0 && stacksize < (size_t)PTHREAD_STACK_MIN)
68b27c
+		stacksize = (size_t)PTHREAD_STACK_MIN;
68b27c
 	ret = pthread_attr_setstacksize(attr, stacksize);
68b27c
 	assert(ret == 0);
68b27c
 	if (detached) {