From: Russ Nelson Date: Wed, 30 Mar 2011 01:49:38 +0000 (+0000) Subject: missing closedir() and ... protected the readdir against opendir() failing X-Git-Tag: 1.31.0-rc.0~31137 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=9734b9be8584357bf77845b8dfaa398ae9d39131;p=lhc%2Fweb%2Fwiklou.git missing closedir() and ... protected the readdir against opendir() failing --- diff --git a/includes/filerepo/FSRepo.php b/includes/filerepo/FSRepo.php index b7b066e267..d3741171b1 100644 --- a/includes/filerepo/FSRepo.php +++ b/includes/filerepo/FSRepo.php @@ -622,8 +622,11 @@ class FSRepo extends FileRepo { continue; } $dir = opendir( $path ); - while ( false !== ( $name = readdir( $dir ) ) ) { - call_user_func( $callback, $path . '/' . $name ); + if ($dir) { + while ( false !== ( $name = readdir( $dir ) ) ) { + call_user_func( $callback, $path . '/' . $name ); + } + closedir( $dir ); } } }