From 829a876182e1db418016f3ad3795da9cbf98024c Mon Sep 17 00:00:00 2001 From: afresh1 Date: Tue, 30 Dec 2014 20:46:45 +0000 Subject: [PATCH] Make perl use our (arc4random backed) drand48 when unseeded uses srand48_deterministic if a seed is provided. seems fine millert@ --- gnu/usr.bin/perl/Configure | 6 +++--- gnu/usr.bin/perl/pp.c | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/gnu/usr.bin/perl/Configure b/gnu/usr.bin/perl/Configure index 8e22a5fc7b2..d34fded7ee1 100644 --- a/gnu/usr.bin/perl/Configure +++ b/gnu/usr.bin/perl/Configure @@ -19620,9 +19620,9 @@ case "$ccflags" in ;; esac -randfunc=Perl_drand48 -drand01="Perl_drand48()" -seedfunc="Perl_drand48_init" +randfunc=drand48 +drand01="drand48()" +seedfunc="srand48" randbits=48 randseedtype=U32 diff --git a/gnu/usr.bin/perl/pp.c b/gnu/usr.bin/perl/pp.c index 4ec6887dfd6..79abdb01f89 100644 --- a/gnu/usr.bin/perl/pp.c +++ b/gnu/usr.bin/perl/pp.c @@ -2785,9 +2785,12 @@ PP(pp_srand) } } else { - anum = seed(); + anum = 0; } + if (anum) + (void)srand48_deterministic((Rand_seed_t)anum); + else (void)seedDrand01((Rand_seed_t)anum); PL_srand_called = TRUE; if (anum) -- 2.20.1