[Pkg-owncloud-commits] [owncloud] 16/78: Check directory handle before we use it

David Prévot taffit at moszumanska.debian.org
Sun May 31 01:59:02 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 03ca380815ed37566b283ddbcc4b2aee566696ef
Author: Robin McCorkell <rmccorkell at karoshi.org.uk>
Date:   Sun Mar 15 18:28:01 2015 +0000

    Check directory handle before we use it
---
 lib/private/tempmanager.php | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/private/tempmanager.php b/lib/private/tempmanager.php
index a3bb07f..60b9c9d 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;
+					}
 				}
 			}
 		}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list