diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2022-02-23 16:04:27 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2022-02-24 12:29:43 -0800 |
commit | 96a025c28bf793f0519737c5d61bd77728b14ddf (patch) | |
tree | 77618cc988b3d089fdf3de476e396a1267613330 /src/corelib/global/qrandom.cpp | |
parent | d581778251c3828bcbfb51013870e7c7383058be (diff) |
QRandomGenerator: find getentropy() on macOS
It's in <sys/random.h>. The header exists on Linux and on FreeBSD and
declares getrandom(), which we don't use, so it's harmless.
Pick-to: 6.3
Change-Id: Ibf4acec0f166495998f7fffd16d69005ab59df3b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/corelib/global/qrandom.cpp')
-rw-r--r-- | src/corelib/global/qrandom.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index eb7eca6388..eb9aa542d3 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -53,7 +53,9 @@ # include <sys/auxv.h> #endif -#if !QT_CONFIG(getentropy) && (!defined(Q_OS_BSD4) || defined(__GLIBC__)) && !defined(Q_OS_WIN) +#if QT_CONFIG(getentropy) && __has_include(<sys/random.h>) +# include <sys/random.h> +#elif !QT_CONFIG(getentropy) && (!defined(Q_OS_BSD4) || defined(__GLIBC__)) && !defined(Q_OS_WIN) # include "qdeadlinetimer.h" # include "qhashfunctions.h" #endif // !QT_CONFIG(getentropy) |