From cff61cb8d69860f933bca223f5127db292a7377b Mon Sep 17 00:00:00 2001 From: serassio <> Date: Sat, 29 Oct 2005 00:49:46 +0000 Subject: [PATCH] Bug #1435: squid-2.5.STABLE12 fails to compile on Solaris and other platforms not having a setenv() function Forward port of 2.5 patch. --- src/cache_cf.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 2634fa7994..7a01ca4c75 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.482 2005/10/23 11:55:33 hno Exp $ + * $Id: cache_cf.cc,v 1.483 2005/10/28 18:49:46 serassio Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -623,8 +623,17 @@ configDoConfigure(void) Config2.effectiveGroupID = pwd->pw_gid; - if (pwd->pw_dir && *pwd->pw_dir) - setenv("HOME", pwd->pw_dir, 1); +#if HAVE_PUTENV + + if (pwd->pw_dir && *pwd->pw_dir) { + int len; + char *env_str = (char *)xcalloc((len = strlen(pwd->pw_dir) + 6), 1); + snprintf(env_str, len, "HOME=%s", pwd->pw_dir); + putenv(env_str); + } + +#endif + } } else { Config2.effectiveUserID = geteuid(); -- 2.47.3