[Pcsclite-cvs-commit] r6948 - trunk/PCSC/src
ludovic.rousseau at free.fr
ludovic.rousseau at free.fr
Wed Aug 6 14:18:06 UTC 2014
Author: rousseau
Date: 2014-08-06 14:18:06 +0000 (Wed, 06 Aug 2014)
New Revision: 6948
Modified:
trunk/PCSC/src/utils.c
Log:
Increase the thread stack size to at least 4 MB
" Recently I tried to run it on a non-glibc system using musl instead.
Turns out musl has a default stacksize of 80KB instead of the
multi-megabyte we are used to in glibc. This leads to segfaults when
pcscd tries to allocate buffers on the stack. To fix this i applied the
following patch:
https://github.com/stef/aports/blob/master/main/pcsc-lite/musl-stacksize.patch
I would be very thankful if you would incorporate this "upstream" so
that other musl users can happily enjoy pcsc and friends. "
Thanks to Stefan Marsiske for the patch
Modified: trunk/PCSC/src/utils.c
===================================================================
--- trunk/PCSC/src/utils.c 2014-08-02 17:32:53 UTC (rev 6947)
+++ trunk/PCSC/src/utils.c 2014-08-06 14:18:06 UTC (rev 6948)
@@ -155,6 +155,7 @@
PCSCLITE_THREAD_FUNCTION(pvFunction), LPVOID pvArg)
{
pthread_attr_t attr;
+ size_t stack_size;
int ret;
ret = pthread_attr_init(&attr);
@@ -169,6 +170,25 @@
return ret;
}
+ /* stack size of 0x400000 (4 MB) bytes minimum for musl C lib */
+ ret = pthread_attr_getstacksize(&attr, &stack_size);
+ if (ret)
+ {
+ (void)pthread_attr_destroy(&attr);
+ return ret;
+ }
+
+ if (stack_size < 0x400000)
+ {
+ stack_size = 0x400000;
+ ret = pthread_attr_setstacksize(&attr, stack_size);
+ if (ret)
+ {
+ (void)pthread_attr_destroy(&attr);
+ return ret;
+ }
+ }
+
ret = pthread_create(pthThread, &attr, pvFunction, pvArg);
if (ret)
return ret;
More information about the Pcsclite-cvs-commit
mailing list