Merge pull request #13977 from owncloud/tempmanager-check-handle

Check directory handle before we use it
This commit is contained in:
Joas Schilling 2015-02-09 16:40:56 +01:00
commit 018f9fddaf
1 changed files with 8 additions and 6 deletions

View File

@ -132,12 +132,14 @@ class TempManager implements ITempManager {
$cutOfTime = time() - 3600;
$files = array();
$dh = opendir($this->tmpBaseDir);
while (($file = readdir($dh)) !== false) {
if (substr($file, 0, 7) === 'oc_tmp_') {
$path = $this->tmpBaseDir . '/' . $file;
$mtime = filemtime($path);
if ($mtime < $cutOfTime) {
$files[] = $path;
if ($dh) {
while (($file = readdir($dh)) !== false) {
if (substr($file, 0, 7) === 'oc_tmp_') {
$path = $this->tmpBaseDir . '/' . $file;
$mtime = filemtime($path);
if ($mtime < $cutOfTime) {
$files[] = $path;
}
}
}
}