diff options
Diffstat (limited to 'src/helperfuncs.cpp')
| -rw-r--r-- | src/helperfuncs.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index aeaad9ab9..16e97da1b 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -456,7 +456,11 @@ unsigned long InspIRCd::GenRandomInt(unsigned long max) const // This is overridden by a higher-quality algorithm when TLS support is loaded void InspIRCd::DefaultGenRandom(char* output, size_t max) { -#if defined HAS_ARC4RANDOM_BUF +#ifdef HAS_GETENTROPY + if (getentropy(output, max) == 0) + return; +#endif +#ifdef HAS_ARC4RANDOM_BUF arc4random_buf(output, max); #else static std::random_device device; |
