2016-08-02 19:59 GMT+02:00 Maksim Ivanov <[email protected]>: > Ludovic, > > Thanks for the quick update. > > Yes, looks like the suggested patch fixes the problem. Great that the > resulting patch is so small. >
Thanks for the feedback. It is now fixed in https://github.com/LudovicRousseau/PCSC/commit/bb07a905c896e7a67e3d7b37a24b3637ada0546d I am not sure to understand your concern about srand (point 3). >> I agree the code is not thread safe. So srand could be called twice. But >> that should not be an issue. srand would be called at least once in all >> cases. Or I am missing something? > > > The effect of calling srand twice is the possible overlaps of the obtained > pseudo-random numbers. Also, srand is not guaranteed to work correctly at > all when used from multiple threads simultaneously. > > Generally, why not just call srand once somewhere around the daemon's > entry point (int main)? Then there would be no questions regarding which > component and how should perform this initialization. > Good idea. Fixed in https://github.com/LudovicRousseau/PCSC/commit/8b80aa4900cd60ab075802bdcc5a996027d0c74e and https://github.com/LudovicRousseau/PCSC/commit/8e820796b338cb1048c51ec462446f61a3979835 I also note that the number of different contexts is limited to RAND_MAX. On my Debian GNU/Linux system I have RAND_MAX = 2147483647 so that should be enough but on some other systems may it be more limited (like 32767). I opened a new feature request so I can remember to work on this (when time and motivation permits) https://alioth.debian.org/tracker/index.php?func=detail&aid=315434&group_id=30105&atid=410088 Bye -- Dr. Ludovic Rousseau
_______________________________________________ Pcsclite-muscle mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pcsclite-muscle
