summaryrefslogtreecommitdiff
path: root/games/phantasia
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-12-06 21:48:53 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-12-06 21:48:53 +0000
commit99f7d832e358aafae4a20e767b7ff31210c4887d (patch)
tree0d21178d992de6b4ae212bcdf5ad9cef92f9ee18 /games/phantasia
parent9e9e683c581c45c1caca670660c0bb9d1906a95d (diff)
Replace things like srandom(time(NULL)) with srandomdev(3). random(3)
good enough for games but we should at least use a decent seed. pjanzen@ OK
Diffstat (limited to 'games/phantasia')
-rw-r--r--games/phantasia/convert.c6
-rw-r--r--games/phantasia/main.c4
-rw-r--r--games/phantasia/setup.c6
3 files changed, 8 insertions, 8 deletions
diff --git a/games/phantasia/convert.c b/games/phantasia/convert.c
index 795315b4d1e..141d7f808eb 100644
--- a/games/phantasia/convert.c
+++ b/games/phantasia/convert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: convert.c,v 1.3 2001/01/28 23:41:47 niklas Exp $ */
+/* $OpenBSD: convert.c,v 1.4 2002/12/06 21:48:51 millert Exp $ */
/* $NetBSD: convert.c,v 1.2 1995/03/24 03:58:34 cgd Exp $ */
/*
@@ -27,7 +27,7 @@ char Newpfile[] = DEST/newcharacs"; /* new format file */
/
/ RETURN VALUE: none
/
-/ MODULES CALLED: time(), exit(), fread(), fopen(), srandom(), floor(),
+/ MODULES CALLED: time(), exit(), fread(), fopen(), srandomdev(), floor(),
/ random(), strcmp(), fwrite(), strcpy(), fclose(), fprintf()
/
/ GLOBAL INPUTS: _iob[], Oldplayer, Newplayer
@@ -59,7 +59,7 @@ FILE *oldcharac, *newcharac; /* to open old and new files */
exit(1);
}
- srandom((unsigned) time(NULL)); /* prime random numbers */
+ srandomdev(); /* prime random numbers */
while (fread((char *) &Oldplayer, sizeof(struct oldplayer), 1, oldcharac) == 1)
/* read and convert old structures into new */
diff --git a/games/phantasia/main.c b/games/phantasia/main.c
index 67b3f2852da..3bfed797ffa 100644
--- a/games/phantasia/main.c
+++ b/games/phantasia/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.10 2002/05/31 05:11:37 pjanzen Exp $ */
+/* $OpenBSD: main.c,v 1.11 2002/12/06 21:48:51 millert Exp $ */
/* $NetBSD: main.c,v 1.3 1995/04/24 12:24:37 cgd Exp $ */
/*
@@ -385,7 +385,7 @@ initialstate()
error(_PATH_VOID);
/* NOTREACHED */
- srandom((unsigned) time(NULL)); /* prime random numbers */
+ srandomdev(); /* prime random numbers */
}
/* */
/************************************************************************
diff --git a/games/phantasia/setup.c b/games/phantasia/setup.c
index 8498aadfc99..dfdad09a1b3 100644
--- a/games/phantasia/setup.c
+++ b/games/phantasia/setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setup.c,v 1.6 2002/05/31 04:21:30 pjanzen Exp $ */
+/* $OpenBSD: setup.c,v 1.7 2002/12/06 21:48:51 millert Exp $ */
/* $NetBSD: setup.c,v 1.4 1995/04/24 12:24:41 cgd Exp $ */
/*
@@ -26,7 +26,7 @@ void Error(char *, char *);
/ RETURN VALUE: none
/
/ MODULES CALLED: time(), exit(), stat(), Error(), open(), close(), fopen(),
-/ fgets(), floor(), srandom(), umask(), strcpy(),
+/ fgets(), floor(), srandomdev(), umask(), strcpy(),
/ unlink(), fwrite(), fclose(), sscanf(), printf(), strlen(), fprintf()
/
/ GLOBAL INPUTS: Curmonster, _iob[], Databuf[], *Monstfp, Enrgyvoid
@@ -82,7 +82,7 @@ main(argc, argv)
argc -= optind;
argv += optind;
- srandom((unsigned) time(NULL)); /* prime random numbers */
+ srandomdev(); /* prime random numbers */
umask(0117); /* only owner can read/write created files */