From d84105ee16d0628fd000249433bcac116c80a87d Mon Sep 17 00:00:00 2001 From: ndparker <> Date: Tue, 20 Mar 2001 09:02:01 +0000 Subject: [PATCH] now the reference counter file will be deleted if the counter is zero - lets save HD-Memory! ;) --- selfforum-cgi/shared/Lock.pm | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/selfforum-cgi/shared/Lock.pm b/selfforum-cgi/shared/Lock.pm index 1d2c929..b1e42d3 100644 --- a/selfforum-cgi/shared/Lock.pm +++ b/selfforum-cgi/shared/Lock.pm @@ -476,9 +476,16 @@ sub w_set_ref ($$$) { # Neuen Referenzwert schreiben $old+=$z; $old=0 if ($old < 0); - open REF,">$reffile" or return 0; - print REF $old; - close REF or return 0; + if ($old == 0) + { + unlink $reffile or return 0; + } + else + { + open REF,">$reffile" or return 0; + print REF $old or return 0; + close REF or return 0; + } # wieder entsperren return 0 unless(&simple_unlock($reffile)); @@ -521,9 +528,16 @@ sub x_set_ref ($$$) { # Neuen Referenzwert schreiben $old += $z; $old = 0 if ($old < 0); - open REF,">$reffile" or return 0; - print REF $old; - close REF or return 0; + if ($old == 0) + { + unlink $reffile or return 0; + } + else + { + open REF,">$reffile" or return 0; + print REF $old or return 0; + close REF or return 0; + } # wieder entsperren return 0 unless(&simple_unlock($reffile)); -- 2.34.1