From 120e800f0e8ecd0336d8fead73634b33ebc9e9fc Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Fri, 19 Mar 2010 07:58:02 +0000
Subject: [PATCH] metarefresh: Fix creation of output directory.

Patch created by Thijs Kinkhorst <thijs@kinkhorst.com>.

Fixes issue 296.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2225 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/metarefresh/lib/MetaLoader.php | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/metarefresh/lib/MetaLoader.php b/modules/metarefresh/lib/MetaLoader.php
index 5b77a46dc..907a90352 100644
--- a/modules/metarefresh/lib/MetaLoader.php
+++ b/modules/metarefresh/lib/MetaLoader.php
@@ -186,9 +186,11 @@ class sspmod_metarefresh_MetaLoader {
 		}
 	
 		if(!file_exists($outputDir)) {
-			if (!is_writable($outputDir)) throw new Exception('Permission denied creating directory: ' . $outputDir);
 			SimpleSAML_Logger::info('Creating directory: ' . $outputDir . "\n");
-			mkdir($outputDir, 0777, TRUE);
+			$res = @mkdir($outputDir, 0777, TRUE);
+			if ($res === FALSE) {
+				throw new Exception('Error creating directory: ' . $outputDir);
+			}
 		}
 	
 		foreach($this->metadata as $category => $elements) {
-- 
GitLab