randomenv: Fix MinGW dllimport warning for `environ`
What changed, and why it matters
This is a one-line build-system warning fix for the Windows MinGW compiler. It changes a preprocessor guard so that the `environ` variable is not re-declared on any Windows build, preventing a harmless compiler warning about inconsistent linkage. There is no functional change to program behavior and no security impact.
No security action required. Treat as normal build warning fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit changes the guard around extern char** environ; from #ifndef _MSC_VER to #ifndef WIN32. On Windows, environ is provided by the C runtime as a macro/dllimport symbol, so redeclaring it as extern triggers an inconsistent linkage warning. The previous guard only suppressed the declaration for MSVC; this extends the suppression to MinGW builds. The change is purely cosmetic/build-hygiene and does not alter runtime entropy collection in randomenv.cpp.
Changed components
src/randomenv.cppInspect captured patch +1 / −1
diff --git a/src/randomenv.cpp b/src/randomenv.cpp
index 84486b38..2d32e50c 100644
--- a/src/randomenv.cpp
+++ b/src/randomenv.cpp
@@ -57,7 +57,7 @@
#include <sys/auxv.h>
#endif
-#ifndef _MSC_VER
+#ifndef WIN32
extern char** environ; // NOLINT(readability-redundant-declaration): Necessary on some platforms
#endif
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.