Comment 3 for bug 1708635

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Not sure how to test this, but...

index b93b9ba47..cfa82d13c 100644
--- a/lib/randutils.c
+++ b/lib/randutils.c
@@ -81,8 +81,10 @@ void random_get_bytes(void *buf, size_t nbytes)
                while (n > 0) {
                        ssize_t x = read(fd, cp, n);
                        if (x <= 0) {
- if (lose_counter++ > 16)
+ if (lose_counter++ > 16) {
+ while (n--) *cp++ = rand();
                                        break;
+ }
                                continue;
                        }
                        n -= x;