diff options
author | 2021-02-15 13:08:54 +0200 | |
---|---|---|
committer | 2021-02-15 13:08:54 +0200 | |
commit | 9569e629c8e73dcdc3f93b5fc6156db827d6b7b1 (patch) | |
tree | 43453709b52f3a1d3f74059c22d85a4d89a54aca /src/cache.c | |
parent | 3f0c21826b4a4e59c937dc8435edb5be7100b078 (diff) | |
download | algos-ld1-9569e629c8e73dcdc3f93b5fc6156db827d6b7b1.tar.gz algos-ld1-9569e629c8e73dcdc3f93b5fc6156db827d6b7b1.tar.bz2 algos-ld1-9569e629c8e73dcdc3f93b5fc6156db827d6b7b1.zip |
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 <gediminas@varciai.lt>
Diffstat (limited to 'src/cache.c')
-rw-r--r-- | src/cache.c | 4 |
1 files changed, 2 insertions, 2 deletions
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); |