From: Ondřej Surý Date: Wed, 23 May 2018 16:26:47 +0000 (+0200) Subject: Provide debugging information for the isc_random function X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Ftest-random;p=thirdparty%2Fbind9.git Provide debugging information for the isc_random function --- diff --git a/lib/isc/random.c b/lib/isc/random.c index 08df74a32f2..a6af0815af7 100644 --- a/lib/isc/random.c +++ b/lib/isc/random.c @@ -30,6 +30,7 @@ #include +#include #include #include #include @@ -96,6 +97,7 @@ getrandom_buf(void *buf, size_t buflen) { while (left > 0) { ret = getrandom(p, left, 0); if (ret == -1 && errno == EINTR) { + fprintf(stderr, "getrandom_buf: getrandom() call interrupted.\n"); continue; } @@ -105,6 +107,9 @@ getrandom_buf(void *buf, size_t buflen) { left -= ret; p += ret; } + if (left > 0) { + fprintf(stderr, "getrandom_buf: getrandom() returned less then requested bytes (%zd < %zu).\n", ret, left+ret); + } } return(0);