dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [dm-devel] [PATCH] libmultipath: fix compile error with glibc-2.34+
@ 2021-08-11 13:11 lixiaokeng
  2021-08-12 11:17 ` Martin Wilck
  0 siblings, 1 reply; 3+ messages in thread
From: lixiaokeng @ 2021-08-11 13:11 UTC (permalink / raw)
  To: Martin Wilck, Benjamin Marzinski, Christophe Varoqui,
	dm-devel mailing list
  Cc: linfeilong, liuzhiqiang (I)

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@huawei.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
---
 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@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dm-devel] [PATCH] libmultipath: fix compile error with glibc-2.34+
  2021-08-11 13:11 [dm-devel] [PATCH] libmultipath: fix compile error with glibc-2.34+ lixiaokeng
@ 2021-08-12 11:17 ` Martin Wilck
  2021-08-12 12:45   ` lixiaokeng
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Wilck @ 2021-08-12 11:17 UTC (permalink / raw)
  To: lixiaokeng, Benjamin Marzinski, Christophe Varoqui,
	dm-devel mailing list
  Cc: linfeilong, liuzhiqiang (I)

Hello Lixiaokeng,

On Mi, 2021-08-11 at 21:11 +0800, lixiaokeng wrote:
> 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@huawei.com>
> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>

Thanks! Ben had already submitted a patch for this in
https://listman.redhat.com/archives/dm-devel/2021-July/msg00159.html.

Ben's patch handles the error case (-1) more correctly.

Regards
Martin



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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dm-devel] [PATCH] libmultipath: fix compile error with glibc-2.34+
  2021-08-12 11:17 ` Martin Wilck
@ 2021-08-12 12:45   ` lixiaokeng
  0 siblings, 0 replies; 3+ messages in thread
From: lixiaokeng @ 2021-08-12 12:45 UTC (permalink / raw)
  To: Martin Wilck, Benjamin Marzinski, Christophe Varoqui,
	dm-devel mailing list
  Cc: linfeilong, liuzhiqiang (I)



On 2021/8/12 19:17, Martin Wilck wrote:
> Hello Lixiaokeng,
> 
> On Mi, 2021-08-11 at 21:11 +0800, lixiaokeng wrote:
>> 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@huawei.com>
>> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
> 
> Thanks! Ben had already submitted a patch for this in
> https://listman.redhat.com/archives/dm-devel/2021-July/msg00159.html.
> 
> Ben's patch handles the error case (-1) more correctly.
> 
> Regards
> Martin
> 
> 

Thanks for reply, I will using Ben's patch to replace my patch.

Regards,
Lixiaokeng


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-12 12:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11 13:11 [dm-devel] [PATCH] libmultipath: fix compile error with glibc-2.34+ lixiaokeng
2021-08-12 11:17 ` Martin Wilck
2021-08-12 12:45   ` lixiaokeng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).