Fix random function detection with static PIE builds

Certain build options didn't like the detection with an no-op. So make it really fetch a random value.

Closes #22981.
PR #22987.
This commit is contained in:
Chocobo1 2025-07-15 01:56:04 +08:00 committed by Vladimir Golovnev (Glassez)
commit a76f12f3db
No known key found for this signature in database
GPG key ID: 52A2C7DEE2DFA6F7

View file

@ -45,7 +45,7 @@ namespace
RandomLayer()
{
if (::getrandom(nullptr, 0, 0) < 0)
if (unsigned char buf = 0; ::getrandom(&buf, sizeof(buf), 0) < 0)
{
if (errno == ENOSYS)
{