summaryrefslogtreecommitdiff
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2014-05-29 04:57:48 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2014-05-29 04:57:48 +0000
commitfb5a10c01e716afcc0d5ba760af14f36af31a8ec (patch)
tree146e787c007f0a42c93851188db2cd9d301fa6f8 /gnu/usr.bin
parent0875fa8f3a589cabd75728203195fd8f5830f395 (diff)
To get a random seed, just call arc4random() instead of reading a
word from the (deprecated) /dev/arandom. This also makes it work in chroot environments. ok deraadt@ afresh@
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/perl/util.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/util.c b/gnu/usr.bin/perl/util.c
index de1ed1b1d63..be1f9a22a3d 100644
--- a/gnu/usr.bin/perl/util.c
+++ b/gnu/usr.bin/perl/util.c
@@ -5586,6 +5586,9 @@ Perl_parse_unicode_opts(pTHX_ const char **popt)
U32
Perl_seed(pTHX)
{
+#if defined(__OpenBSD__)
+ return arc4random();
+#else
dVAR;
/*
* This is really just a quick hack which grabs various garbage
@@ -5662,6 +5665,7 @@ Perl_seed(pTHX)
u += SEED_C5 * (U32)PTR2UV(&when);
#endif
return u;
+#endif
}
void