From 4ff30d57c654f34d04eb1cc5b2b76e4d52c78b35 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 12 Jun 2022 22:56:26 +0200 Subject: [PATCH] cpl_spawn.cpp: fix linking with FreeBSD (found with CheriBSD) --- port/cpl_spawn.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/port/cpl_spawn.cpp b/port/cpl_spawn.cpp index fa93d12358d5..a5f8425e70cc 100644 --- a/port/cpl_spawn.cpp +++ b/port/cpl_spawn.cpp @@ -57,7 +57,11 @@ #include #define environ (*_NSGetEnviron()) #else - extern char** environ; + #if defined(__FreeBSD__) + extern __attribute__((__weak__)) char **environ; + #else + extern char** environ; + #endif #endif #endif #endif