[PATCH] libmultipath: fix compile error with glibc-2.34+

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There is an error when complie with glibc-2.34:
comparison of integer expressions of different signedness:
'size_t' {aka 'long unsigned int'} and 'long int'
[-Werror=sign-compare]

The reason is that PTHREAD_STACK_MIN may be defined
long int which is  signed in glibc-2.34+. Explicitly assign
it to the size_t variable to  fix it.

Signed-off-by: Lixiaokeng <lixiaokeng@xxxxxxxxxx>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@xxxxxxxxxx>
---
 libmultipath/util.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libmultipath/util.c b/libmultipath/util.c
index 0e37f3ff..5c2fd5c6 100644
--- a/libmultipath/util.c
+++ b/libmultipath/util.c
@@ -220,11 +220,12 @@ void
 setup_thread_attr(pthread_attr_t *attr, size_t stacksize, int detached)
 {
 	int ret;
+	size_t pthread_stack_min = PTHREAD_STACK_MIN;

 	ret = pthread_attr_init(attr);
 	assert(ret == 0);
-	if (stacksize < PTHREAD_STACK_MIN)
-		stacksize = PTHREAD_STACK_MIN;
+	if (stacksize < pthread_stack_min)
+		stacksize = pthread_stack_min;
 	ret = pthread_attr_setstacksize(attr, stacksize);
 	assert(ret == 0);
 	if (detached) {
-- 

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux