[NoCat] Patch: file_close-01.patch

Karl Gaissmaier karl.gaissmaier at kiz.uni-ulm.de
Tue, 29 Jul 2003 01:27:09 +0200


--------------Boundary-00=_95DRR851TTI81X6N4BXG
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 8bit

Name:
	file_close-01.patch
	
Affected Files:
	lib/NoCat.pm

Version:
	Patch against 0.82 or later

Severity:
	unimportant, just defensive programming

Description:
	closes no longer needed files, hence fork must not deal
	with unnecessary open fd's

-- Karl Gaissmaier KIZ/Infrastructure, University of Ulm, Germany 
Email:karl.gaissmaier@kiz.uni-ulm.de Service Group Network
--------------Boundary-00=_95DRR851TTI81X6N4BXG
Content-Type: text/x-diff;
  charset="us-ascii";
  name="file_close-01.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="file_close-01.patch"

diff -Naur NoCatAuth-nightly/lib/NoCat.pm NoCatAuth-mod/lib/NoCat.pm
--- NoCatAuth-nightly/lib/NoCat.pm	Sun Jul 13 12:00:04 2003
+++ NoCatAuth-mod/lib/NoCat.pm	Fri Jul 25 14:58:40 2003
@@ -113,10 +113,14 @@
 	or return $self->log( 1, "file $filename: $!" );
 
     if ( wantarray ) {
-	return <FILE>;
+	my @buf = <FILE>;
+	close FILE;
+	return @buf;
     } else {
 	local $/ = undef; 
-	return <FILE>;
+	my $buf = <FILE>;
+	close FILE;
+	return $buf;
     }
 }
 

--------------Boundary-00=_95DRR851TTI81X6N4BXG--