back out; it slows down (interactive) work on slow machines

quite a bit, and users can seed $RANDOM in their ~/.profile
by using RANDOM=$(dd if=/dev/prandom count=1 2>/dev/null |\
cksum | while read a b; do echo $a; done) instead.
This commit is contained in:
tg 2004-04-26 18:38:20 +00:00
parent b77a4be013
commit c4fec215ff
2 changed files with 3 additions and 17 deletions

View File

@ -1,4 +1,4 @@
.\" $MirBSD: ksh.1tbl,v 1.20 2004/04/26 18:20:45 tg Exp $
.\" $MirBSD: ksh.1tbl,v 1.21 2004/04/26 18:38:19 tg Exp $
.\" $OpenBSD: ksh.1tbl,v 1.65 2004/01/23 23:08:45 jmc Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
@ -1565,11 +1565,6 @@ The point in the series can be set by assigning a number to
.Ev RANDOM
(see
.Xr rand 3 ) .
On startup,
.Nm
reads four bytes out of
.Pa /dev/urandom
if exists, and XORs the default seed with it.
.It Ev REPLY
Default parameter for the
.Ic read
@ -5107,7 +5102,6 @@ deleted and a new prompt to be printed.
.It Pa ~/.profile
.It Pa /etc/profile
.It Pa /etc/suid_profile
.It Pa /dev/urandom
.El
.Sh SEE ALSO
.Xr awk 1 ,

12
main.c
View File

@ -1,4 +1,4 @@
/* $MirBSD: main.c,v 1.4 2004/04/26 18:28:07 tg Exp $ */
/* $MirBSD: main.c,v 1.5 2004/04/26 18:38:20 tg Exp $ */
/* $OpenBSD: main.c,v 1.26 2004/01/08 05:43:14 jmc Exp $ */
/*
@ -94,8 +94,6 @@ main(int argc, char *argv[])
char **wp;
struct env env;
pid_t ppid;
long trnd;
FILE *tfil;
#ifdef MEM_DEBUG
chmem_set_defaults("ct", 1);
@ -258,13 +256,7 @@ main(int argc, char *argv[])
ppid = getppid();
setint(global("PPID"), (long) ppid);
#ifdef KSH
trnd = *((long *)kshname);
if (Flag(FSH) != 1) if ((tfil = fopen("/dev/urandom", "rb")) != NULL) {
fread(&trnd, 4, 1, tfil);
fclose(tfil);
}
trnd ^= (long) (time((time_t *)0) * kshpid * ppid);
setint(global("RANDOM"), trnd);
setint(global("RANDOM"), (long) (time((time_t *)0) * kshpid * ppid));
#endif /* KSH */
/* setstr can't fail here */
setstr(global(version_param), ksh_version, KSH_RETURN_ERROR);