2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00
This commit is contained in:
Michael Graff
2000-06-09 22:24:22 +00:00
parent 2003deb5d1
commit f8b50c193f
3 changed files with 2 additions and 12 deletions

View File

@@ -71,10 +71,9 @@ main(int argc, char **argv) {
isc_entropy_stats(ent, stderr);
#if 1
#if 0
devrandom = NULL;
flags = 0;
flags |= ISC_ENTROPYSOURCE_ISDEVICE;
CHECK("isc_entropy_createfilesource()",
isc_entropy_createfilesource(ent, "/dev/random",
flags, &devrandom));

View File

@@ -97,14 +97,8 @@ ISC_LANG_BEGINDECLS
* If this is not set, the source will be gathered and perodically
* mixed into the entropy pool, but no increment in contained entropy
* will be assumed. This flag only makes sense on sample sources.
*
* _ISDEVICE
* The file named is really a device file, and blocking is possible.
* Otherwise, the file is assumed to be a finite length file, and
* any I/O error (including blocking) terminates the source.
*/
#define ISC_ENTROPYSOURCE_ESTIMATE 0x00000001U
#define ISC_ENTROPYSOURCE_ISDEVICE 0x00000002U
/***
*** Functions

View File

@@ -278,13 +278,10 @@ get_from_filesource(isc_entropysource_t *source, isc_uint32_t desired) {
int fd = source->sources.file.fd;
ssize_t n, ndesired;
isc_uint32_t added;
isc_boolean_t isdevice;
if (fd == -1)
return (0);
isdevice = ISC_TF((source->flags & ISC_ENTROPYSOURCE_ISDEVICE) != 0);
desired = desired / 8 + (((desired & 0x07) > 0) ? 1 : 0);
added = 0;
@@ -292,7 +289,7 @@ get_from_filesource(isc_entropysource_t *source, isc_uint32_t desired) {
ndesired = ISC_MIN(desired, sizeof(buf));
n = read(fd, buf, ndesired);
if (n < 0) {
if (isdevice && (errno == EAGAIN))
if (errno == EAGAIN)
goto out;
close(fd);
source->sources.file.fd = -1;