From: Karel Zak Date: Mon, 14 Aug 2017 08:56:08 +0000 (+0200) Subject: lib/randutils: reset lose counter X-Git-Tag: v2.30.2~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c73ef5e8ba43b9b7b45a9fd87d65eb641a8343a2;p=thirdparty%2Futil-linux.git lib/randutils: reset lose counter It's probaly good idea to reset lose counter when we fallback from getrandom() to /dev/urandom. Signed-off-by: Karel Zak --- diff --git a/lib/randutils.c b/lib/randutils.c index 5cd1c9976e..43afc601d3 100644 --- a/lib/randutils.c +++ b/lib/randutils.c @@ -120,7 +120,6 @@ void random_get_bytes(void *buf, size_t nbytes) if (errno == ENOSYS) #endif - /* * We've been built against headers that support getrandom, but the * running kernel does not. Fallback to reading from /dev/{u,}random @@ -129,6 +128,7 @@ void random_get_bytes(void *buf, size_t nbytes) { int fd = random_get_fd(); + lose_counter = 0; if (fd >= 0) { while (n > 0) { ssize_t x = read(fd, cp, n);