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:
parent
b77a4be013
commit
c4fec215ff
8
ksh.1tbl
8
ksh.1tbl
@ -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 $
|
.\" $OpenBSD: ksh.1tbl,v 1.65 2004/01/23 23:08:45 jmc Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1980, 1990, 1993
|
.\" Copyright (c) 1980, 1990, 1993
|
||||||
@ -1565,11 +1565,6 @@ The point in the series can be set by assigning a number to
|
|||||||
.Ev RANDOM
|
.Ev RANDOM
|
||||||
(see
|
(see
|
||||||
.Xr rand 3 ) .
|
.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
|
.It Ev REPLY
|
||||||
Default parameter for the
|
Default parameter for the
|
||||||
.Ic read
|
.Ic read
|
||||||
@ -5107,7 +5102,6 @@ deleted and a new prompt to be printed.
|
|||||||
.It Pa ~/.profile
|
.It Pa ~/.profile
|
||||||
.It Pa /etc/profile
|
.It Pa /etc/profile
|
||||||
.It Pa /etc/suid_profile
|
.It Pa /etc/suid_profile
|
||||||
.It Pa /dev/urandom
|
|
||||||
.El
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr awk 1 ,
|
.Xr awk 1 ,
|
||||||
|
12
main.c
12
main.c
@ -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 $ */
|
/* $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;
|
char **wp;
|
||||||
struct env env;
|
struct env env;
|
||||||
pid_t ppid;
|
pid_t ppid;
|
||||||
long trnd;
|
|
||||||
FILE *tfil;
|
|
||||||
|
|
||||||
#ifdef MEM_DEBUG
|
#ifdef MEM_DEBUG
|
||||||
chmem_set_defaults("ct", 1);
|
chmem_set_defaults("ct", 1);
|
||||||
@ -258,13 +256,7 @@ main(int argc, char *argv[])
|
|||||||
ppid = getppid();
|
ppid = getppid();
|
||||||
setint(global("PPID"), (long) ppid);
|
setint(global("PPID"), (long) ppid);
|
||||||
#ifdef KSH
|
#ifdef KSH
|
||||||
trnd = *((long *)kshname);
|
setint(global("RANDOM"), (long) (time((time_t *)0) * kshpid * ppid));
|
||||||
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);
|
|
||||||
#endif /* KSH */
|
#endif /* KSH */
|
||||||
/* setstr can't fail here */
|
/* setstr can't fail here */
|
||||||
setstr(global(version_param), ksh_version, KSH_RETURN_ERROR);
|
setstr(global(version_param), ksh_version, KSH_RETURN_ERROR);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user