[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH] a fix for #131548



Basically, I'm just reordering the logic in read_config() so 
that the filehandle is opened and then file is statted.
-Thom

--- apacheconfig.old	Thu Jan 24 19:28:27 2002
+++ apacheconfig	Sun Feb 10 18:50:13 2002
@@ -33,7 +33,6 @@
 $MAILNAME_CONF="/etc/mailname";
 $ALIASES_CONF="/etc/aliases";
 $HOME_EX="/usr/share/doc/apache/intro.html";
-
 $SERVER_ROOT="/etc/apache";
 $PID_FILE="/var/run/apache.pid";
 
@@ -50,7 +49,7 @@
 $opt_assert_perl = 0;
 $opt_force = 0;
 $opt_force_modules = 0;
-$opt_manual_modules = 0;
+$opt_manual_modules = 1;
 $opt_fullauto = 0;
 $opt_update = 0;
 $opt_documentroot = "/var/www";
@@ -106,17 +105,18 @@
     $main::servergroup = "www-data" if $main::servergroup =~ m/-/;
 }
 
+
+
 sub read_config {
     my $file = shift;
     my $config = '';
-
     # Convert relative files to absolute based on $SERVER_ROOT.
     # BUG: doesn't work if actual server root isn't $SERVER_ROOT, however this
     # case is expected to be highly unlikely for the vast majority of people.
     if ($file !~ m{^/}) {
         $file = "$SERVER_ROOT/$file";
     }
-
+    
     # Ignore files with inodes that we've already seen,
     # tip from Daniel Jacobowitz.
     # Note that our list of seen inodes needs to be persistent
@@ -127,16 +127,6 @@
         ref($main::read_config_seen_files) ne "HASH") {
         $main::read_config_seen_files = {};
     }
-    my $filestat = stat($file);
-    if ($filestat) {
-        if ($main::read_config_seen_files->{$filestat->ino}) {
-            # Already read this file, stop here
-            return $config;
-        } else {
-            # Remember this inode
-            $main::read_config_seen_files->{$filestat->ino} = 1;
-        }
-    }
 
     if (-d $file) {
         # We have a directory, per apache docs this means that all files in
@@ -150,6 +140,16 @@
         # For an include replace it with the contents of the file or
         # set of files (aka directory) it references.
         my $reader = IO::File->new($file);
+        my $filestat = stat($reader);
+        if ($filestat) {
+    	    if ($main::read_config_seen_files->{$filestat->ino}) {
+        	# Already read this file, stop here
+        	return $config;
+            } else {
+            	# Remember this inode
+            	$main::read_config_seen_files->{$filestat->ino} = 1;
+           }
+        }
         while (<$reader>) {
             if (/^\s*include\s+([\S]+)/i) {
                 $config .= read_config($1);
@@ -547,7 +547,6 @@
     my $m = `egrep -l "$k" $d/*.info 2> /dev/null`;
     return split ("\n", $m);
 }
-
 
 sub module_required ($;$)
 {



Reply to: