diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2015-02-09 16:40:56 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2015-02-09 16:40:56 +0100 |
commit | 018f9fddafe571cdd04257b438596498a843429e (patch) | |
tree | ee91e80899ba7b84b9d2ed767c9417595301e22b | |
parent | 0d8b3afc32f15b1582bbf555796b9d112a91a4ef (diff) | |
parent | 45e3cbefc9e069d5c904ed8961504551a51ce735 (diff) | |
download | nextcloud-server-018f9fddafe571cdd04257b438596498a843429e.tar.gz nextcloud-server-018f9fddafe571cdd04257b438596498a843429e.zip |
Merge pull request #13977 from owncloud/tempmanager-check-handle
Check directory handle before we use it
-rw-r--r-- | lib/private/tempmanager.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/private/tempmanager.php b/lib/private/tempmanager.php index a3bb07f9d63..60b9c9dc0d4 100644 --- a/lib/private/tempmanager.php +++ b/lib/private/tempmanager.php @@ -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; + } } } } |