Mercurial > dropbear
comparison random.c @ 855:04ede40a529a
- Some fixes for old compilers like tru64 v4 from Daniel Richard G.
- Don't warn about blocking random device for prngd
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 14 Nov 2013 21:36:45 +0800 |
parents | 3a9ec98808c3 |
children | c19acba28590 |
comparison
equal
deleted
inserted
replaced
854:ccc76acaf4c7 | 855:04ede40a529a |
---|---|
77 readcount = 0; | 77 readcount = 0; |
78 while (len == 0 || readcount < len) | 78 while (len == 0 || readcount < len) |
79 { | 79 { |
80 int readlen, wantread; | 80 int readlen, wantread; |
81 unsigned char readbuf[4096]; | 81 unsigned char readbuf[4096]; |
82 if (!already_blocked) | 82 if (!already_blocked && !prngd) |
83 { | 83 { |
84 int res; | 84 int res; |
85 struct timeval timeout = { .tv_sec = 2, .tv_usec = 0}; | 85 struct timeval timeout; |
86 fd_set read_fds; | 86 fd_set read_fds; |
87 | |
88 timeout.tv_sec = 2; | |
89 timeout.tv_usec = 0; | |
87 | 90 |
88 FD_ZERO(&read_fds); | 91 FD_ZERO(&read_fds); |
89 FD_SET(readfd, &read_fds); | 92 FD_SET(readfd, &read_fds); |
90 res = select(readfd + 1, &read_fds, NULL, NULL, &timeout); | 93 res = select(readfd + 1, &read_fds, NULL, NULL, &timeout); |
91 if (res == 0) | 94 if (res == 0) |