handle EINTR when reading /dev/urandom

This commit is contained in:
Alexandre Ratchov 2015-02-16 18:56:30 +01:00
parent 98027ba688
commit 52e645e422
1 changed files with 2 additions and 0 deletions

View File

@ -57,6 +57,8 @@ random_bytes(unsigned char *buf, int len)
while (len > 0) {
n = read(fd, buf, len);
if (n < 0) {
if (errno == EINTR)
continue;
DPERROR(DEV_RANDOM);
close(fd);
return 0;