Hi Johnothan, On Jan 26 22:06, Johnothan King via Cygwin wrote: > Hello, > > While testing ksh93u+m's recently added SRANDOM variable[1], I have > discovered a bug in Cygwin's arc4random function. After using fork(), > arc4random does not reseed itself, which causes the results to become > predictable[2]. Below is a test case C program exhibiting the bug: > > #include <stdio.h> > #include <stdlib.h> > #include <unistd.h> > #include <sys/wait.h> > int main(void) > { > pid_t child = fork(); > if(child==0) > { > printf("%u %u %u\n", arc4random(), arc4random(), arc4random()); > return 0; > } > else if(child==-1) > return 1; > waitpid(child, NULL, 0); > printf("%u %u %u\n", arc4random(), arc4random(), arc4random()); > return 0; > }
Thanks for the testcase. I fixed that for Cygwin 3.5. Please try the latest test release cygwin-3.5.0-0.617.g030a762535c1, which should be finished building in about an hour. Thanks, Corinna -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple