From f6851391ced7566dc8970e4d3f13623fd4d409d4 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 24 Apr 2006 07:02:11 +0000 Subject: [PATCH] Fixed package configuration generation - if the file handle is invalid the script won't leave the while loop git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3084 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_debconfTemplate.inc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/include/class_debconfTemplate.inc b/include/class_debconfTemplate.inc index 4d94d0e94..d781321ec 100644 --- a/include/class_debconfTemplate.inc +++ b/include/class_debconfTemplate.inc @@ -53,9 +53,19 @@ class debconf $in_description = FALSE; $got_local_description = FALSE; + /* get filename */ + $filename= preg_replace("/\/+/", "/", $this->template_directory."/".$this->package.".templates"); + + /* Check if file is readable */ + if (!is_file($filename) || !is_readable($filename)){ + return(FALSE); + } + + /* Open file and read content line by line */ $fh= fopen($filename, 'r'); - while (!feof($fh)){ + /* While the file handle is valid && there is still data to read -> parse configuration file */ + while ($fh && !feof($fh)){ $line= fgets($fh, 1024); /* Reset description flag */ -- 2.30.2