summaryrefslogtreecommitdiffstats
path: root/fortune/fortune/fortune.c
diff options
context:
space:
mode:
authormrg <mrg@NetBSD.org>2000-10-31 13:27:56 +0000
committermrg <mrg@NetBSD.org>2000-10-31 13:27:56 +0000
commit475daa4e639b6aaab6a075677d1d9ff3ed846f4e (patch)
treea32b24037dee90f73e1e2512f3c9fcd8ccff342d /fortune/fortune/fortune.c
parent36d758ad12e9b0550fdd55efce7e8a79de3ae4c6 (diff)
downloadbsdgames-darwin-475daa4e639b6aaab6a075677d1d9ff3ed846f4e.tar.gz
bsdgames-darwin-475daa4e639b6aaab6a075677d1d9ff3ed846f4e.tar.zst
bsdgames-darwin-475daa4e639b6aaab6a075677d1d9ff3ed846f4e.zip
fix a bug in the call to srandom(): xor time() with getpid(), don't add them!
now fortune(6) run in an unending loop does not appear to show the same fortunes over and over and over.
Diffstat (limited to 'fortune/fortune/fortune.c')
-rw-r--r--fortune/fortune/fortune.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fortune/fortune/fortune.c b/fortune/fortune/fortune.c
index 2cc318ce..fc507599 100644
--- a/fortune/fortune/fortune.c
+++ b/fortune/fortune/fortune.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fortune.c,v 1.23 2000/04/14 05:58:02 simonb Exp $ */
+/* $NetBSD: fortune.c,v 1.24 2000/10/31 13:27:56 mrg Exp $ */
/*-
* Copyright (c) 1986, 1993
@@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 1993\n\
#if 0
static char sccsid[] = "@(#)fortune.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: fortune.c,v 1.23 2000/04/14 05:58:02 simonb Exp $");
+__RCSID("$NetBSD: fortune.c,v 1.24 2000/10/31 13:27:56 mrg Exp $");
#endif
#endif /* not lint */
@@ -223,7 +223,7 @@ main(ac, av)
#endif
init_prob();
- srandom((int)(time((time_t *) NULL) + getpid()));
+ srandom((int)(time((time_t *) NULL) ^ getpid()));
do {
get_fort();
} while ((Short_only && fortlen() > SLEN) ||