Have child processes srand on startup.
Andrew Rodland [Fri, 21 Nov 2014 02:57:10 +0000 (21:57 -0500)]
This makes sure that each child has independent random numbers even if
someone called rand() before the fork. Starman does this, and it's
a good idea.

lib/FCGI/ProcManager.pm

index 93ed425..e5b0fbc 100644 (file)
@@ -456,6 +456,10 @@ sub handling_init {
 
   # change the name of this process as it appears in ps(1) output.
   $this->pm_change_process_name("perl-fcgi");
+
+  # Re-srand in case someone called rand before the fork, so that
+  # children get different random numbers.
+  srand;
 }
 
 =head2 pm_pre_dispatch