I wonder if a better approach might be to make /dev/random return 0
bytes when unseeded, instead of blocking. Then srandomdev() would
automatically back down to seeding internally, for example, and no
other code changes in mount_mfs would be needed.
A warning could be emitted in this case for diagnostic purposes
(e.g. in case something actually needs cryptographic randomness and
isn't getting it because it's running too early) - this should be the
only case when /dev/random returns 0 bytes on a read.
Kris
On Thu, Jan 11, 2001 at 07:07:44PM -0500, Garrett Wollman wrote:
> Index: mkfs.c
> ===================================================================
> RCS file: /home/ncvs/src/sbin/newfs/mkfs.c,v
> retrieving revision 1.32
> diff -u -r1.32 mkfs.c
> --- mkfs.c 2000/10/24 03:28:59 1.32
> +++ mkfs.c 2001/01/12 00:05:59
> @@ -192,7 +192,13 @@
> #ifdef FSIRAND
> if (!randinit) {
> randinit = 1;
> - srandomdev();
> + if (mfs) {
> + time_t t;
> + time(&t);
> + srandom(t);
> + } else {
> + srandomdev();
> + }
> }
> #endif
> if (mfs) {
PGP signature