Changeset View
Changeset View
Standalone View
Standalone View
b/cipher/rndlinux.c
Context not available. | |||||
#endif | #endif | ||||
#endif | #endif | ||||
while( length ) { | while( length ) { | ||||
#ifdef FD_SETSIZE | |||||
fd_set rfds; | fd_set rfds; | ||||
struct timeval tv; | struct timeval tv; | ||||
int rc; | int rc; | ||||
FD_ZERO(&rfds); | FD_ZERO(&rfds); | ||||
FD_SET(fd, &rfds); | |||||
tv.tv_sec = 3; | tv.tv_sec = 3; | ||||
tv.tv_usec = 0; | tv.tv_usec = 0; | ||||
if( !(rc=select(fd+1, &rfds, NULL, NULL, &tv)) ) { | if (fd < FD_SETSIZE) | ||||
if( !warn ) | { | ||||
FD_SET(fd, &rfds); | |||||
if( !(rc=select(fd+1, &rfds, NULL, NULL, &tv)) ) { | |||||
if( !warn ) | |||||
tty_printf( | tty_printf( | ||||
_("\n" | _("\n" | ||||
"Not enough random bytes available. Please do some other work to give\n" | "Not enough random bytes available. Please do some other work to give\n" | ||||
"the OS a chance to collect more entropy! (Need %d more bytes)\n"), (int)length ); | "the OS a chance to collect more entropy! (Need %d more bytes)\n"), (int)length ); | ||||
warn = 1; | warn = 1; | ||||
continue; | continue; | ||||
} | } | ||||
else if( rc == -1 ) { | else if( rc == -1 ) { | ||||
tty_printf( | tty_printf( | ||||
"select() error: %s\n", strerror(errno)); | "select() error: %s\n", strerror(errno)); | ||||
continue; | continue; | ||||
} | } | ||||
} | |||||
#endif /*FD_SETSIZE*/ | |||||
do { | do { | ||||
int nbytes = length < sizeof(buffer)? length : sizeof(buffer); | int nbytes = length < sizeof(buffer)? length : sizeof(buffer); | ||||
Context not available. |