From 9124572c8f318c021632b9ed66adf081fa4ff176 Mon Sep 17 00:00:00 2001 From: Neil Blakey-Milner Date: Thu, 22 Sep 2005 20:32:47 +0000 Subject: [PATCH] Error out if the file or directory can not be read properly. --- lib/import/fsimportstorage.inc.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/import/fsimportstorage.inc.php b/lib/import/fsimportstorage.inc.php index e1736c5..30b615c 100644 --- a/lib/import/fsimportstorage.inc.php +++ b/lib/import/fsimportstorage.inc.php @@ -55,8 +55,14 @@ class KTFSImportStorage extends KTImportStorage { return PEAR::raiseError('Failed to open folder'); } while (($sFilename = readdir($rDir)) !== false) { + if (in_array($sFilename, array(".", ".."))) { + continue; + } $sThisPath = sprintf("%s/%s", $sFullPath, $sFilename); - if (is_file($sThisPath)) { + if (!file_exists($sThisPath)) { + return PEAR::raiseError('Could not read file: ' . $sThisPath); + } + if (@is_file($sThisPath)) { if (empty($sFolderPath)) { $ret[] = $sFilename; } else { @@ -86,7 +92,10 @@ class KTFSImportStorage extends KTImportStorage { continue; } $sThisPath = sprintf("%s/%s", $sFullPath, $sFilename); - if (is_dir($sThisPath)) { + if (!file_exists($sThisPath)) { + return PEAR::raiseError('Could not read file: ' . $sThisPath); + } + if (@is_dir($sThisPath)) { if (empty($sFolderPath)) { $ret[] = $sFilename; } else { -- libgit2 0.21.4