aboutsummaryrefslogtreecommitdiff
path: root/sbin/fsirand/fsirand.c
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1997-03-24 15:51:11 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1997-03-24 15:51:11 +0000
commitc59856210e18c75775f664effaa6d142035d4902 (patch)
tree10a1d244ed2188d2adf2b6cf58615cbd7cc1af69 /sbin/fsirand/fsirand.c
parentcb78754c1239d6fb197ba3be77208b2101f58959 (diff)
downloadsrc-c59856210e18c75775f664effaa6d142035d4902.tar.gz
src-c59856210e18c75775f664effaa6d142035d4902.zip
Include missing <time.h>
Add missing RNG initialization Use srandomdev() for RNG initialization
Notes
Notes: svn path=/head/; revision=24216
Diffstat (limited to 'sbin/fsirand/fsirand.c')
-rw-r--r--sbin/fsirand/fsirand.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sbin/fsirand/fsirand.c b/sbin/fsirand/fsirand.c
index 4875ef59482d..640dd173cbd2 100644
--- a/sbin/fsirand/fsirand.c
+++ b/sbin/fsirand/fsirand.c
@@ -50,6 +50,7 @@ static char rcsid[] = "$OpenBSD: fsirand.c,v 1.9 1997/02/28 00:46:33 millert Exp
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include <unistd.h>
void usage __P((int));
@@ -85,6 +86,9 @@ main(argc, argv)
if (argc - optind < 1)
usage(1);
+ if (srandomdev() < 0)
+ srandom(time(NULL) ^ getpid());
+
/* Increase our data size to the max */
if (getrlimit(RLIMIT_DATA, &rl) == 0) {
rl.rlim_cur = rl.rlim_max;