diff options
author | Jack Lloyd <[email protected]> | 2016-01-20 09:59:34 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-07-17 10:43:40 -0400 |
commit | 255ec3717e95492184c9499685b7204a292f7141 (patch) | |
tree | 4231c8ea38a8d512f53edfac070e13ab5c1d9fd6 /src | |
parent | 8a1aead31c9ae9caa405c6951de8aa51d6a4b751 (diff) |
If EPERM when writing to the random device, return silently.
That failure seems like an explicit system policy decision, so accept
it as such. Versus say EBADF or EFAULT which would instead suggest a
library bug.
This return is seen on OS X Travis CI, unclear if this is a problem
with OS X or with how Travis does OS X containers.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/rng/system_rng/system_rng.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/rng/system_rng/system_rng.cpp b/src/lib/rng/system_rng/system_rng.cpp index b6440d968..a503c2198 100644 --- a/src/lib/rng/system_rng/system_rng.cpp +++ b/src/lib/rng/system_rng/system_rng.cpp @@ -122,7 +122,19 @@ void System_RNG_Impl::add_entropy(const byte input[], size_t len) if(errno == EINTR) continue; - // maybe just ignore failure here and return? + /* + * This is seen on OS X CI, despite the fact that the man page + * for Darwin urandom explicitly states that writing to it is + * supported, and write(2) does not document EPERM at all. + * But in any case EPERM seems indicative of a policy decision + * by the OS or sysadmin that additional entropy is not wanted + * in the system pool, so we accept that and return here, + * since there is no corrective action possible. + */ + if(errno == EPERM) + return; + + // maybe just ignore any failure here and return? throw Exception("System_RNG write failed error " + std::to_string(errno)); } |