You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Enrico Sorcinelli <e....@pisa.iol.it> on 2002/10/25 18:11:09 UTC

[PATCH] Apache::Session

Hi Jeffrey,
I've found a little bug in clean method of Apache::Session::Lock::File when
it checks lockfiles last access time.
In effects the result of the expression (file ./Session/Lock/File.pm, line 136)

	(stat($dir.'/'.$file))[8] - $now

is always negative and lock dir cleanup isn't done.
The patch simply inverts the check (also I've attached it)

Bye,
	Enrico

PS: Sorry for this re-post, but I've submitted this patch also a few months
ago with no response ;-)

-------------

--- File.pm     Sat Sep  2 00:21:17 2000
+++ File.pm-patched     Sat Mar 30 10:38:54 2002
@@ -133,7 +133,7 @@
     my @files = readdir(DIR);
     foreach my $file (@files) {
         if ($file =~ /^Apache-Session.*\.lock$/) {
-            if ((stat($dir.'/'.$file))[8] - $now >= $time) {
+            if ($now - (stat($dir.'/'.$file))[8] >= $time) {
                 open(FH, "+>$dir/".$file) || next;
                 flock(FH, LOCK_EX) || next;
                 unlink($dir.'/'.$file) || next;