From 2ca055470973dae1007c51731b912a4649bdb90c Mon Sep 17 00:00:00 2001
From: Cyrill Gorcunov <gorcunov@gmail.com>
Date: Mon, 2 Mar 2020 10:47:12 +0300
Subject: [PATCH] popen: allow accessing environ variable

This is part of posix standart.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 src/lib/core/popen.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/src/lib/core/popen.c b/src/lib/core/popen.c
index 1cfe58ee0a..0e2d9dd009 100644
--- a/src/lib/core/popen.c
+++ b/src/lib/core/popen.c
@@ -591,9 +591,7 @@ close_inherited_fds(int *skip_fds, size_t nr_skip_fds)
 	return 0;
 }
 
-#ifdef TARGET_OS_LINUX
 extern char **environ;
-#endif
 
 /**
  * Get pointer to environment variables to use in
@@ -603,17 +601,8 @@ static inline char **
 get_envp(struct popen_opts *opts)
 {
 	if (!opts->env) {
-#ifdef TARGET_OS_LINUX
 		/* Inherit existing ones if not specified */
 		return environ;
-#else
-		static const char **empty_envp[] = { NULL };
-		static bool said = false;
-		if (!said)
-			say_warn("popen: Environment inheritance "
-				 "unsupported, passing empty");
-		return (char **)empty_envp;
-#endif
 	}
 	return opts->env;
 }
-- 
GitLab