gbde(8) - simplify randomisation with arc4random_buf

Submitted by:	David CARLIER <devnexen AT gmail.com>
Differential Revision:	https://reviews.freebsd.org/D18678
This commit is contained in:
Conrad Meyer 2019-02-11 00:11:02 +00:00
parent f3f08e16a3
commit 39f37df26e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=343991

View File

@ -174,18 +174,7 @@ g_read_data(struct g_consumer *cp, off_t offset, off_t length, int *error)
static void
random_bits(void *p, u_int len)
{
static int fdr = -1;
int i;
if (fdr < 0) {
fdr = open("/dev/urandom", O_RDONLY);
if (fdr < 0)
err(1, "/dev/urandom");
}
i = read(fdr, p, len);
if (i != (int)len)
err(1, "read from /dev/urandom");
arc4random_buf(p, len);
}
/* XXX: not nice */