From: serassio <> Date: Sun, 2 Oct 2005 20:28:47 +0000 (+0000) Subject: Bug #1401: $HOME not set when started as root X-Git-Tag: SQUID_3_0_PRE4~589 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=08ac5ea724a97eaa2663e11968381b02197e5919;p=thirdparty%2Fsquid.git Bug #1401: $HOME not set when started as root 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. --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 434e753fd8..f214d37d08 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -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();