From 9569e629c8e73dcdc3f93b5fc6156db827d6b7b1 Mon Sep 17 00:00:00 2001 From: Gediminas Jakutis Date: Mon, 15 Feb 2021 13:08:54 +0200 Subject: cease inefficient /dev/urandom fiddling. Instead of reading /dev/urandom like a file (i.e. overhead / extra syscalls, etc.), just use getrandom(2) directly, lol. Signed-off-by: Gediminas Jakutis --- src/cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/cache.c') diff --git a/src/cache.c b/src/cache.c index fe97fef..0c99322 100644 --- a/src/cache.c +++ b/src/cache.c @@ -35,8 +35,8 @@ int cache_populate(struct stream * const in) try(in->settings->access != cached, err, EINVAL, "cannot populate cache: stream is uncached"); - /* if reading a chardev, fall back to the one-element-at-a-time mode */ - if (in->type == stream_chardev) { + /* if reading a a randstream, fall back to the one-element-at-a-time mode */ + if (in->type == stream_randread) { for (i = 0; i < in->n && !ret; ++i) { errno = 0; tmp = in->get_next_element_direct(in); -- cgit v1.2.3