From c01675de5d6650c7b1cd0571d8c313f21d13c33c Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 5 Sep 2013 11:58:57 +0200 Subject: more is_resource checks before readdir --- lib/files/storage/mappedlocal.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'lib/files/storage') diff --git a/lib/files/storage/mappedlocal.php b/lib/files/storage/mappedlocal.php index fbf1b4ebf96..ba5ac4191c5 100644 --- a/lib/files/storage/mappedlocal.php +++ b/lib/files/storage/mappedlocal.php @@ -65,16 +65,18 @@ class MappedLocal extends \OC\Files\Storage\Common{ $logicalPath = $this->mapper->physicalToLogic($physicalPath); $dh = opendir($physicalPath); - while (($file = readdir($dh)) !== false) { - if ($file === '.' or $file === '..') { - continue; - } + if(is_resource($dh)) { + while (($file = readdir($dh)) !== false) { + if ($file === '.' or $file === '..') { + continue; + } - $logicalFilePath = $this->mapper->physicalToLogic($physicalPath.'/'.$file); + $logicalFilePath = $this->mapper->physicalToLogic($physicalPath.'/'.$file); - $file= $this->mapper->stripRootFolder($logicalFilePath, $logicalPath); - $file = $this->stripLeading($file); - $files[]= $file; + $file= $this->mapper->stripRootFolder($logicalFilePath, $logicalPath); + $file = $this->stripLeading($file); + $files[]= $file; + } } \OC\Files\Stream\Dir::register('local-win32'.$path, $files); -- cgit v1.2.3