Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/games/fortune/strfile Revert arc4random usage for now
details: https://anonhg.NetBSD.org/src/rev/b4cae25630a1
branches: trunk
changeset: 1012261:b4cae25630a1
user: nia <nia%NetBSD.org@localhost>
date: Sun Jul 26 15:14:09 2020 +0000
description:
Revert arc4random usage for now
this is a host tool and needs to be portable
future plans: add arc4random to libnbcompat
diffstat:
games/fortune/strfile/strfile.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (36 lines):
diff -r 123b81df4f1c -r b4cae25630a1 games/fortune/strfile/strfile.c
--- a/games/fortune/strfile/strfile.c Sun Jul 26 15:13:09 2020 +0000
+++ b/games/fortune/strfile/strfile.c Sun Jul 26 15:14:09 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: strfile.c,v 1.41 2020/07/21 03:05:40 nia Exp $ */
+/* $NetBSD: strfile.c,v 1.42 2020/07/26 15:14:09 nia Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -47,7 +47,7 @@
#if 0
static char sccsid[] = "@(#)strfile.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: strfile.c,v 1.41 2020/07/21 03:05:40 nia Exp $");
+__RCSID("$NetBSD: strfile.c,v 1.42 2020/07/26 15:14:09 nia Exp $");
#endif
#endif /* not lint */
#endif /* __NetBSD__ */
@@ -438,6 +438,8 @@
off_t tmp;
off_t *sp;
+ srandom((int)(time(NULL) + getpid()));
+
Tbl.str_flags |= STR_RANDOM;
cnt = Tbl.str_numstr;
@@ -446,7 +448,7 @@
*/
for (sp = Seekpts; cnt > 0; cnt--, sp++) {
- i = arc4random_uniform(cnt);
+ i = random() % cnt;
tmp = sp[0];
sp[0] = sp[i];
sp[i] = tmp;
Home |
Main Index |
Thread Index |
Old Index