]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #1401: $HOME not set when started as root
authorserassio <>
Sun, 2 Oct 2005 20:28:47 +0000 (20:28 +0000)
committerserassio <>
Sun, 2 Oct 2005 20:28:47 +0000 (20:28 +0000)
some helpers may depend on $HOME being set to something sane, which is
not always the case when Squid is started as root. This patch sets $HOME
to the home of cache_effective_user.

Forward port of 2.5 patch.

src/cache_cf.cc

index 434e753fd8abecbdfebb66786644e4671666b21b..f214d37d08995b1c5ca06ed948ea2160f1145e0e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_cf.cc,v 1.480 2005/09/17 05:50:07 wessels Exp $
+ * $Id: cache_cf.cc,v 1.481 2005/10/02 14:28:47 serassio Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -622,6 +622,9 @@ configDoConfigure(void)
             Config2.effectiveUserID = pwd->pw_uid;
 
             Config2.effectiveGroupID = pwd->pw_gid;
+
+            if (pwd->pw_dir && *pwd->pw_dir)
+                setenv("HOME", pwd->pw_dir, 1);
         }
     } else {
         Config2.effectiveUserID = geteuid();