Compare commits

...

1 Commits

Author SHA1 Message Date
Ondřej Surý
be16142ea5 Provide debugging information for the isc_random function 2018-05-23 21:37:47 +02:00

View File

@@ -30,6 +30,7 @@
#include <config.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
@@ -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);