From 0c48b342a5ba01f26c3d9fbd74ee3f0a2ae06e7a Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 28 Jul 2015 07:50:37 +0200 Subject: [PATCH] dskspace() checks if directory could be opened --- inc/inc.Utils.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/inc/inc.Utils.php b/inc/inc.Utils.php index 74ed5e79a..371b29770 100644 --- a/inc/inc.Utils.php +++ b/inc/inc.Utils.php @@ -329,11 +329,12 @@ function dskspace($dir) { /* {{{ */ if(is_file($dir)) { $space = filesize($dir); } elseif (is_dir($dir)) { - $dh = opendir($dir); - while (($file = readdir($dh)) !== false) - if ($file != "." and $file != "..") - $space += dskspace($dir."/".$file); - closedir($dh); + if($dh = opendir($dir)) { + while (($file = readdir($dh)) !== false) + if ($file != "." and $file != "..") + $space += dskspace($dir."/".$file); + closedir($dh); + } } return $space; } /* }}} */