aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-10-03 00:40:29 +0200
committerdoktornotor <notordoktor@gmail.com>2015-10-03 00:40:29 +0200
commit596f04c575f215f26d46293af75e21ab2cae2885 (patch)
tree153d0b6c382208eb9374dbeabdd0aa0de82ec66a /config
parentbb4be348cf074430dad2ce77f21f79f7e5cfb939 (diff)
downloadpfsense-packages-596f04c575f215f26d46293af75e21ab2cae2885.tar.gz
pfsense-packages-596f04c575f215f26d46293af75e21ab2cae2885.tar.bz2
pfsense-packages-596f04c575f215f26d46293af75e21ab2cae2885.zip
Do not loop when trying to chown inaccessible directory and log some debug info
Some whacky issue with screwed filesystem/permissions reported at https://forum.pfsense.org/index.php?topic=100167.msg559007#msg559007 - cannot get any meaningful info from the guy there.
Diffstat (limited to 'config')
-rwxr-xr-xconfig/squid3/34/squid.inc24
1 files changed, 14 insertions, 10 deletions
diff --git a/config/squid3/34/squid.inc b/config/squid3/34/squid.inc
index 654aeb3c..ae367d3a 100755
--- a/config/squid3/34/squid.inc
+++ b/config/squid3/34/squid.inc
@@ -91,18 +91,22 @@ function squid_chown_recursive($dir, $user, $group) {
chown($dir, $user);
chgrp($dir, $group);
- $handle = opendir($dir) ;
- while (($item = readdir($handle)) !== false) {
- if (!empty($item) && ($item != ".") && ($item != "..")) {
- $path = "{$dir}/{$item}";
- // Recurse unless it's the cache dir, that is slow and rarely necessary.
- if (is_dir($path) && (basename($dir) != "cache")) {
- squid_chown_recursive($path, $user, $group);
- } elseif (is_file($path)) {
- chown($path, $user);
- chgrp($path, $group);
+ $handle = opendir($dir);
+ if ($handle) {
+ while (($item = readdir($handle)) !== false) {
+ if (!empty($item) && ($item != ".") && ($item != "..")) {
+ $path = "{$dir}/{$item}";
+ // Recurse unless it's the cache dir, that is slow and rarely necessary.
+ if (is_dir($path) && (basename($dir) != "cache")) {
+ squid_chown_recursive($path, $user, $group);
+ } elseif (is_file($path)) {
+ chown($path, $user);
+ chgrp($path, $group);
+ }
}
}
+ } else {
+ log_error(gettext("Squid squid_chown_recursive call failed; permissions not set for directory: {$dir}"));
}
}