tests: re-seed random number generator in workers

This commit is contained in:
Michael Stapelberg 2017-09-10 19:41:49 +02:00
parent eba177342f
commit bed5c9e03a
1 changed files with 5 additions and 0 deletions

View File

@ -99,6 +99,11 @@ sub worker_wait {
$0 = $file;
# Re-seed rand() so that File::Temps tempnam produces different
# results, making a TOCTOU between e.g. t/175-startup-notification.t
# and t/180-fd-leaks.t less likely.
srand(time ^ $$);
POSIX::dup2($ipc_fd, 0);
POSIX::dup2($ipc_fd, 1);
POSIX::dup2(1, 2);