reset urandomfd if it delivers an EBADF (seeing this on Mesh Extenders)

This commit is contained in:
gardners 2013-05-07 13:52:19 +09:30
parent 0898981807
commit 243a26707e

1
os.c
View File

@ -110,6 +110,7 @@ int urandombytes(unsigned char *buf, unsigned long long len)
if (i == -1) { if (i == -1) {
if (++tries > 4) { if (++tries > 4) {
WHY_perror("read(/dev/urandom)"); WHY_perror("read(/dev/urandom)");
if (errno==EBADF) urandomfd=-1;
return -1; return -1;
} }
sleep(1); sleep(1);