From 79d6f458e2300e1f47b94467cda233e1c761f8be Mon Sep 17 00:00:00 2001 From: fanquake Date: Mon, 27 Oct 2025 12:34:02 +0100 Subject: [PATCH] random: scope environ extern to macOS, BSDs and Illumos These platforms fail to compile with it removed. --- src/randomenv.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/randomenv.cpp b/src/randomenv.cpp index 2d32e50cab7..3aff81d1437 100644 --- a/src/randomenv.cpp +++ b/src/randomenv.cpp @@ -57,8 +57,12 @@ #include #endif -#ifndef WIN32 -extern char** environ; // NOLINT(readability-redundant-declaration): Necessary on some platforms +#if defined(__APPLE__) || \ + defined(__FreeBSD__) || \ + defined(__NetBSD__) || \ + defined(__OpenBSD__) || \ + defined(__illumos__) +extern char** environ; // NOLINT(readability-redundant-declaration): Necessary on the above platforms #endif namespace {