]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #1435: squid-2.5.STABLE12 fails to compile on Solaris and other
authorserassio <>
Sat, 29 Oct 2005 00:49:46 +0000 (00:49 +0000)
committerserassio <>
Sat, 29 Oct 2005 00:49:46 +0000 (00:49 +0000)
platforms not having a setenv() function

Forward port of 2.5 patch.

src/cache_cf.cc

index 2634fa7994ed875f1e04465730d0b1cd3264e3a8..7a01ca4c75315381e84864725945abf9721b1ecf 100644 (file)
@@ -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();