libmultipath: fix compile error with glibc-2.34+
PATCH 1/1 libmultipath: fix compile error with glibc-2.34+
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.
--- libmultipath/util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
libmultipath/util.c +3 -2
@@ -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) {
Signature · 4 lines
-- dm-devel mailing list [email protected] https://listman.redhat.com/mailman/listinfo/dm-devel
Hello Lixiaokeng,
Quoted 11 lines · lixiaokeng
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_MINmay be defined long int which is signed in glibc-2.34+. Explicitly assign it to thesize_tvariable to fix it.Signed-off-by Lixiaokeng <[email protected]>Signed-off-by Zhiqiang Liu <[email protected]>
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
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
Quoted 15 lines · Martin Wilck
Hello Lixiaokeng,
Quoted 11 lines · lixiaokeng
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_MINmay be defined long int which is signed in glibc-2.34+. Explicitly assign it to thesize_tvariable to fix it.Signed-off-by Lixiaokeng <[email protected]>Signed-off-by Zhiqiang Liu <[email protected]>
Quoted 9 lines
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
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel